Skip to content

Commit

Permalink
Fixes #136771: update to Electron v13.5.2 and pass `--ms-enable-run-a…
Browse files Browse the repository at this point in the history
…s-node` together with `ELECTRON_RUN_AS_NODE`
  • Loading branch information
deepak1556 authored and alexdima committed Nov 9, 2021
1 parent 36b7d6e commit ac29daa
Show file tree
Hide file tree
Showing 14 changed files with 19 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .yarnrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
disturl "https://electronjs.org/headers"
target "13.5.1"
target "13.5.2"
runtime "electron"
build_from_source "true"
2 changes: 1 addition & 1 deletion extensions/git/src/askpass.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/sh
VSCODE_GIT_ASKPASS_PIPE=`mktemp`
ELECTRON_RUN_AS_NODE="1" VSCODE_GIT_ASKPASS_PIPE="$VSCODE_GIT_ASKPASS_PIPE" "$VSCODE_GIT_ASKPASS_NODE" "$VSCODE_GIT_ASKPASS_MAIN" $*
ELECTRON_RUN_AS_NODE="1" VSCODE_GIT_ASKPASS_PIPE="$VSCODE_GIT_ASKPASS_PIPE" "$VSCODE_GIT_ASKPASS_NODE" "$VSCODE_GIT_ASKPASS_EXTRA_ARGS" "$VSCODE_GIT_ASKPASS_MAIN" $*
cat $VSCODE_GIT_ASKPASS_PIPE
rm $VSCODE_GIT_ASKPASS_PIPE
1 change: 1 addition & 0 deletions extensions/git/src/askpass.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ export class Askpass implements IIPCHandler {
...this.ipc.getEnv(),
GIT_ASKPASS: path.join(__dirname, 'askpass.sh'),
VSCODE_GIT_ASKPASS_NODE: process.execPath,
VSCODE_GIT_ASKPASS_EXTRA_ARGS: !!process.versions['electron'] ? '--ms-enable-electron-run-as-node' : '',
VSCODE_GIT_ASKPASS_MAIN: path.join(__dirname, 'askpass-main.js')
};
}
Expand Down
2 changes: 1 addition & 1 deletion resources/darwin/bin/code.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ function realpath() { python -c "import os,sys; print(os.path.realpath(sys.argv[
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" "$@"
ELECTRON_RUN_AS_NODE=1 "$ELECTRON" --ms-enable-electron-run-as-node "$CLI" "$@"
exit $?
2 changes: 1 addition & 1 deletion resources/linux/bin/code.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,5 @@ fi

ELECTRON="$VSCODE_PATH/@@NAME@@"
CLI="$VSCODE_PATH/resources/app/out/cli.js"
ELECTRON_RUN_AS_NODE=1 "$ELECTRON" "$CLI" "$@"
ELECTRON_RUN_AS_NODE=1 "$ELECTRON" --ms-enable-electron-run-as-node "$CLI" "$@"
exit $?
4 changes: 2 additions & 2 deletions resources/win32/bin/code.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
setlocal
set VSCODE_DEV=
set ELECTRON_RUN_AS_NODE=1
"%~dp0..\@@NAME@@.exe" "%~dp0..\resources\app\out\cli.js" %*
endlocal
"%~dp0..\@@NAME@@.exe" --ms-enable-electron-run-as-node "%~dp0..\resources\app\out\cli.js" %*
endlocal
4 changes: 2 additions & 2 deletions resources/win32/bin/code.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ if [ $IN_WSL = true ]; then
# use the Remote WSL extension if installed
WSL_EXT_ID="ms-vscode-remote.remote-wsl"

ELECTRON_RUN_AS_NODE=1 "$ELECTRON" "$CLI" --locate-extension $WSL_EXT_ID >/tmp/remote-wsl-loc.txt 2>/dev/null </dev/null
ELECTRON_RUN_AS_NODE=1 "$ELECTRON" --ms-enable-electron-run-as-node "$CLI" --locate-extension $WSL_EXT_ID >/tmp/remote-wsl-loc.txt 2>/dev/null </dev/null
WSL_EXT_WLOC=$(cat /tmp/remote-wsl-loc.txt)

if [ -n "$WSL_EXT_WLOC" ]; then
Expand All @@ -58,5 +58,5 @@ elif [ -x "$(command -v cygpath)" ]; then
else
CLI="$VSCODE_PATH/resources/app/out/cli.js"
fi
ELECTRON_RUN_AS_NODE=1 "$ELECTRON" "$CLI" "$@"
ELECTRON_RUN_AS_NODE=1 "$ELECTRON" --ms-enable-electron-run-as-node "$CLI" "$@"
exit $?
2 changes: 1 addition & 1 deletion scripts/code-cli.bat
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ set ELECTRON_ENABLE_LOGGING=1
set ELECTRON_ENABLE_STACK_DUMPING=1

:: Launch Code
%CODE% --inspect=5874 out\cli.js %~dp0.. %*
%CODE% --ms-enable-electron-run-as-node --inspect=5874 out\cli.js %~dp0.. %*
goto end

:builtin
Expand Down
2 changes: 1 addition & 1 deletion scripts/code-cli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function code() {
VSCODE_DEV=1 \
ELECTRON_ENABLE_LOGGING=1 \
ELECTRON_ENABLE_STACK_DUMPING=1 \
"$CODE" --inspect=5874 "$ROOT/out/cli.js" . "$@"
"$CODE" --ms-enable-electron-run-as-node --inspect=5874 "$ROOT/out/cli.js" . "$@"
}

code "$@"
2 changes: 1 addition & 1 deletion scripts/code.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ function code-wsl()
cd $ROOT
export WSLENV=ELECTRON_RUN_AS_NODE/w:VSCODE_DEV/w:$WSLENV
local WSL_EXT_ID="ms-vscode-remote.remote-wsl"
local WSL_EXT_WLOC=$(echo "" | VSCODE_DEV=1 ELECTRON_RUN_AS_NODE=1 "$ROOT/.build/electron/Code - OSS.exe" "out/cli.js" --locate-extension $WSL_EXT_ID)
local WSL_EXT_WLOC=$(echo "" | VSCODE_DEV=1 ELECTRON_RUN_AS_NODE=1 "$ROOT/.build/electron/Code - OSS.exe" --ms-enable-electron-run-as-node "out/cli.js" --locate-extension $WSL_EXT_ID)
cd $CWD
if [ -n "$WSL_EXT_WLOC" ]; then
# replace \r\n with \n in WSL_EXT_WLOC
Expand Down
4 changes: 2 additions & 2 deletions scripts/node-electron.bat
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ set NAMESHORT=%NAMESHORT: "=%
set NAMESHORT=%NAMESHORT:"=%.exe
set CODE=".build\electron\%NAMESHORT%"

%CODE% %*
%CODE% --ms-enable-electron-run-as-node %*

popd

endlocal
exit /b %errorlevel%
exit /b %errorlevel%
2 changes: 2 additions & 0 deletions scripts/node-electron.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@ export VSCODE_DEV=1
if [[ "$OSTYPE" == "darwin"* ]]; then
ulimit -n 4096 ; ELECTRON_RUN_AS_NODE=1 \
"$CODE" \
--ms-enable-electron-run-as-node \
"$@"
else
ELECTRON_RUN_AS_NODE=1 \
"$CODE" \
--ms-enable-electron-run-as-node \
"$@"
fi
4 changes: 2 additions & 2 deletions src/vs/platform/environment/node/shellEnv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,10 @@ async function doResolveUnixShellEnv(logService: ILogService, token: Cancellatio
if (/^pwsh(-preview)?$/.test(name)) {
// Older versions of PowerShell removes double quotes sometimes so we use "double single quotes" which is how
// you escape single quotes inside of a single quoted string.
command = `& '${process.execPath}' -p '''${mark}'' + JSON.stringify(process.env) + ''${mark}'''`;
command = `& '${process.execPath}' --ms-enable-electron-run-as-node -p '''${mark}'' + JSON.stringify(process.env) + ''${mark}'''`;
shellArgs = ['-Login', '-Command'];
} else {
command = `'${process.execPath}' -p '"${mark}" + JSON.stringify(process.env) + "${mark}"'`;
command = `'${process.execPath}' --ms-enable-electron-run-as-node -p '"${mark}" + JSON.stringify(process.env) + "${mark}"'`;

if (name === 'tcsh') {
shellArgs = ['-ic'];
Expand Down
1 change: 1 addition & 0 deletions src/vs/server/remoteCli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ export function main(desc: ProductDescription, args: string[]): void {
} else {
const cliCwd = dirname(cliCommand);
const env = { ...process.env, ELECTRON_RUN_AS_NODE: '1' };
newCommandline.unshift('--ms-enable-electron-run-as-node');
newCommandline.unshift('resources/app/out/cli.js');
if (parsedArgs['verbose']) {
console.log(`Invoking: ${cliCommand} ${newCommandline.join(' ')} in ${cliCwd}`);
Expand Down

2 comments on commit ac29daa

@ridum
Copy link

@ridum ridum commented on ac29daa Nov 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was using the terminal in an ssh host and trying to pull a git repo, it seems like the change in extensions/git/src/askpass.sh makes the pulling process stuck indefinitely; the prompt of asking git credentials shows up only after I reverting this change;

@alexdima
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ridum Please update to 1.62.3. We have had a number of regressions in this area that we have fixed in the meantime: #136837 , #137183

Please sign in to comment.