File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -11,14 +11,9 @@ VSCODE_PATH="$(dirname "$(dirname "$(realpath "$0")")")"
1111ELECTRON=" $VSCODE_PATH /$NAME .exe"
1212if grep -qi Microsoft /proc/version; then
1313 # in a wsl shell
14- if [ " $WSL_DISTRO_NAME " ]; then
15- # $WSL_DISTRO_NAME is available since WSL builds 18362, also for WSL2
16- WSL_BUILD=18362
17- else
18- WSL_BUILD=$( uname -r | sed -E ' s/^.+-([0-9]+)-Microsoft/\1/' )
19- if [ -z " $WSL_BUILD " ]; then
20- WSL_BUILD=0
21- fi
14+ WSL_BUILD=$( uname -r | sed -E ' s/^[0-9.]+-([0-9]+)-Microsoft|([0-9]+).([0-9]+).([0-9]+)-microsoft-standard|.*/\1\2\3\4/' )
15+ if [ -z " $WSL_BUILD " ]; then
16+ WSL_BUILD=0
2217 fi
2318
2419 if [ $WSL_BUILD -ge 17063 ]; then
@@ -30,7 +25,18 @@ if grep -qi Microsoft /proc/version; then
3025
3126 # use the Remote WSL extension if installed
3227 WSL_EXT_ID=" ms-vscode-remote.remote-wsl"
33- WSL_EXT_WLOC=$( ELECTRON_RUN_AS_NODE=1 " $ELECTRON " " $CLI " --locate-extension $WSL_EXT_ID )
28+
29+ if [ $WSL_BUILD -ge 41955 ]; then
30+ # WSL2 in workaround for https://github.com/microsoft/WSL/issues/4337
31+ CWD=" $( pwd) "
32+ cd " $VSCODE_PATH "
33+ cmd.exe /C " .\\ bin\\ $APP_NAME .cmd --locate-extension $WSL_EXT_ID >remote-wsl-loc.txt"
34+ WSL_EXT_WLOC=" $( cat ./remote-wsl-loc.txt) "
35+ rm remote-wsl-loc.txt
36+ cd " $CWD "
37+ else
38+ WSL_EXT_WLOC=$( ELECTRON_RUN_AS_NODE=1 " $ELECTRON " " $CLI " --locate-extension $WSL_EXT_ID )
39+ fi
3440 if [ -n " $WSL_EXT_WLOC " ]; then
3541 # replace \r\n with \n in WSL_EXT_WLOC
3642 WSL_CODE=$( wslpath -u " ${WSL_EXT_WLOC%% [[:cntrl:]]} " ) /scripts/wslCode.sh
You can’t perform that action at this time.
0 commit comments