Issue
In VSCode's (MacOS) launch script, we can find the following lines:
CONTENTS="$(dirname "$(dirname "$(dirname "$(dirname "$(realpath "$0")")")")")"
ELECTRON="$CONTENTS/MacOS/Electron"
CLI="$CONTENTS/Resources/app/out/cli.js"
ELECTRON_RUN_AS_NODE=1 "$ELECTRON" "$CLI" "$@"
What is going on with the last line (which actually goes and executes the CLI)? Why is there a 1 in front of the command?
Solution
When you put a variable assignment at the beginning of a shell command, it sets that environment variable temporarily while running the command. So the last line is effectively equivalent to:
(
export ELECTRON_RUN_AS_NODE=1
"$ELECTRON" "$CLI" "$@"
)
The parentheses put the commands in a subshell, so the variable assignment doesn't persist.
Answered By - Barmar Answer Checked By - Senaida (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.