From 51fd831f9a71dcf8834fb9f076dbed31ff2bfc45 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Fri, 13 Jan 2017 18:01:35 -0800 Subject: [PATCH] Fix cli.js always opening from WSL shell Also support relative paths Fixes #13138 --- win32/bin/code.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/win32/bin/code.sh b/win32/bin/code.sh index 1281a1f8c38b5..251d718cfee49 100644 --- a/win32/bin/code.sh +++ b/win32/bin/code.sh @@ -6,6 +6,14 @@ 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 CLI=$(cygpath -m "$VSCODE_PATH/resources/app/out/cli.js") else