Skip to content

Fix sys.debugMode when using VSCode's new preview debugger #37558

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 26, 2020

Conversation

rbuckton
Copy link
Contributor

VSCode's new "preview" debug extension doesn't use --inspect (or --inspect-brk) to launch the debugger, so this adds a new heuristic to detecting whether the compiler was launched from the debugger.

The preview debugger launches the program with something like the following script (this example uses the powershell console):

${env:NODE_ENV}='development';
${env:NODE_INSPECTOR_IPC}='\\.\pipe\node-cdp.15176-2.sock';
${env:NODE_INSPECTOR_PPID}='';
${env:NODE_INSPECTOR_WAIT_FOR_DEBUGGER}='';
${env:NODE_OPTIONS}='--require C:\Users\<user>\AppData\Local\Temp\vscode-js-debug-bootloader.js ';
${env:NODE_INSPECTOR_EXEC_PATH}='C:\Users\<user>\AppData\Roaming\nodejs\node.exe';
${env:VSCODE_DEBUGGER_FILE_CALLBACK}='C:\Users\<user>\AppData\Local\Temp\node-debug-callback-<id>';
${env:VSCODE_DEBUGGER_ONLY_ENTRYPOINT}='false';
& 'C:\Users\<user>\AppData\Roaming\nodejs\node.exe' 'C:\dev\TypeScript-bugfix/built/local/tsc.js'

The new heuristic checks for the presence of the NODE_INSPECTOR_IPC environment variable in addition to checking for --inspect or --debug.

@rbuckton rbuckton merged commit 9119fe3 into master Mar 26, 2020
@rbuckton rbuckton deleted the fixDebugMode branch March 26, 2020 02:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants