From 7372479a5393aa477dc3991f07fcdd5e28353cb9 Mon Sep 17 00:00:00 2001 From: Connor Peet Date: Wed, 18 Sep 2024 15:42:42 -0700 Subject: [PATCH] fix: running new npm scripts in internal terminal Fixes https://github.com/microsoft/vscode/issues/227285 --- CHANGELOG.md | 1 + src/targets/node/bootloader/filters.ts | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fe378dd4c..936cadb56 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ This changelog records changes to stable releases since 1.50.2. "TBA" changes he - feat: improve display of HTML elements in the debugger - feat: add node tool picker completion for launch.json ([#1997](https://github.com/microsoft/vscode-js-debug/issues/1997)) - fix: process attachment with `--inspect=:1234` style ([#2063](https://github.com/microsoft/vscode-js-debug/issues/2063)) +- fix: running new npm scripts in internal terminal ([vscode#227285](https://github.com/microsoft/vscode/issues/227285)) ## v1.93 (August 2024) diff --git a/src/targets/node/bootloader/filters.ts b/src/targets/node/bootloader/filters.ts index b6b82f195..e21f3b7dd 100644 --- a/src/targets/node/bootloader/filters.ts +++ b/src/targets/node/bootloader/filters.ts @@ -68,7 +68,7 @@ export const checkProcessFilter = (env: IBootloaderInfo) => { * session and cause us to think it's over before it actually is. * @see https://github.com/microsoft/vscode-js-debug/issues/645 */ -export const checkNotNpmPrefixCheckOnWindows = () => { +const checkNotNpmPrefixCheckOnWindows = () => { const argv = process.argv; return !( argv.length === 4 @@ -78,6 +78,15 @@ export const checkNotNpmPrefixCheckOnWindows = () => { ); }; +/** + * Similar as above for more recent versions of npm + * @see https://github.com/microsoft/vscode-js-debug/issues/645 + */ +const checkNotNpmPrefixCheckOnWindows2 = () => { + const argv = process.argv; + return !(argv.length === 2 && basename(argv[1]) === 'npm-prefix.js'); +}; + /** * Disable attaching to the node-gyp tree, otherwise some checks it does fails * since Node writes debugger information to stderr. @@ -103,6 +112,7 @@ const allChecks = [ checkNotElectron, checkProcessFilter, checkNotNpmPrefixCheckOnWindows, + checkNotNpmPrefixCheckOnWindows2, ]; /**