fix: correctly check mega-evme binary in command existence check#195
fix: correctly check mega-evme binary in command existence check#195Ocheretovich wants to merge 2 commits intomegaeth-labs:mainfrom
Conversation
|
|
||
| # Check mega-evme binary separately (handle args) | ||
| MEGA_EVME_BIN=${MEGA_EVME%% *} | ||
| if ! command -v "$MEGA_EVME_BIN" &>/dev/null; then |
There was a problem hiding this comment.
The existence check fix is correct here — extracting the binary name via ${MEGA_EVME%% *} handles the case where MEGA_EVME contains arguments.
However, the actual invocation on line 101 still uses "$MEGA_EVME" (double-quoted), which means if MEGA_EVME="mega-evme --some-flag", bash will try to execute the entire string as a single command name rather than splitting it into command + arguments. So the scenario this PR fixes for the existence check would still fail at runtime.
To make this work end-to-end, line 101 should use $MEGA_EVME unquoted (to allow word splitting) or use an array-based approach:
| if ! command -v "$MEGA_EVME_BIN" &>/dev/null; then | |
| if ! command -v "$MEGA_EVME_BIN" &>/dev/null; then |
And then also change line 101 from "$MEGA_EVME" to $MEGA_EVME (unquoted) so that arguments are properly word-split.
Handle cases where MEGA_EVME includes arguments by checking only the binary name. Prevents false negatives in command existence check