Skip to content

Commit

Permalink
Merge pull request microsoft#44945 from 0xabu/wsl-cli-fix
Browse files Browse the repository at this point in the history
enable CLI when invoked from WSL on modern (RS4) hosts
  • Loading branch information
Tyriar authored May 15, 2018
2 parents c0126de + 8505dcc commit 005666c
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions resources/win32/bin/code.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,20 @@ NAME="@@NAME@@"
VSCODE_PATH="$(dirname "$(dirname "$(realpath "$0")")")"
ELECTRON="$VSCODE_PATH/$NAME.exe"
if grep -q Microsoft /proc/version; then
# If running under WSL don't pass cli.js to Electron as environment vars
# cannot be transferred from WSL to Windows
# See: https://github.com/Microsoft/BashOnWindows/issues/1363
# https://github.com/Microsoft/BashOnWindows/issues/1494
"$ELECTRON" "$@"
exit $?
fi
if [ "$(expr substr $(uname -s) 1 9)" == "CYGWIN_NT" ]; then
if [ -x /bin/wslpath ]; then
# On recent WSL builds, we just need to set WSLENV so that
# ELECTRON_RUN_AS_NODE is visible to the win32 process
export WSLENV=ELECTRON_RUN_AS_NODE/w:$WSLENV
CLI=$(wslpath -m "$VSCODE_PATH/resources/app/out/cli.js")
else
# If running under older WSL, don't pass cli.js to Electron as
# environment vars cannot be transferred from WSL to Windows
# See: https://github.com/Microsoft/BashOnWindows/issues/1363
# https://github.com/Microsoft/BashOnWindows/issues/1494
"$ELECTRON" "$@"
exit $?
fi
elif [ "$(expr substr $(uname -s) 1 9)" == "CYGWIN_NT" ]; then
CLI=$(cygpath -m "$VSCODE_PATH/resources/app/out/cli.js")
else
CLI="$VSCODE_PATH/resources/app/out/cli.js"
Expand Down

0 comments on commit 005666c

Please sign in to comment.