Does this issue occur when all extensions are disabled?: Yes
- VS Code Version: 1.103.2,
6f17636121051a53c88d3e605c491d22af2ba755, x64
- OS Version: Windows 11 version 24H2 build 26100.3775 x64
Steps to Reproduce:
- Close all existing Code windows and all existing PowerShell instances.
- Start PowerShell, run
code; exit.
- Observe that the PowerShell console or the PowerShell terminal tab hangs.
- Open Task Manager and look for PowerShell process. Observe that PowerShell has exited.
- Close the Code window normally (not using Task Manager). Observe that the PowerShell console or the PowerShell terminal tab exits once the Code window is closed.
Expected behavior: Step 3, the console or the terminal tab should exit.
Steps to Reproduce (continued):
- Close all existing Code windows and all existing PowerShell instances.
- Start PowerShell, run
code, then close the console or the terminal tab using the X button.
- Start PowerShell again, run
code; exit.
- Observe that the second console or the second terminal tab exits normally.
There are other things to try, such as using code path-to-dir or code path-to-file. A simple description consistent with what I observe in all those trials:
- If the
code command opens a new window (file or directory or just running code), then it will block the console host or the terminal from shutting down, until the newly opened window is closed.
- If the
code command did not open a new window, then it will not block the console host or the terminal from shutting down.
Psychic debugging:
- The
code command starts Code.exe (for cli.js). Let's call the started process Code[1]. It is monitored by the terminal tab.
- If
Code[1] determines a new window is not needed, it communicates the action to an existing window, and Code[1] terminates (unless --wait is specified). This means if the code command did not open a new window, then it will not block tab close.
- If
Code[1] determines a new window is needed, it will launch some other Code.exe instances. For reason unknown to me, one of them (I suspect Code[1] does, also it seems to be the one hosting GUI) causes the terminal tab to wait upon closing.
Normally, a GUI-subsystem program should be detached from the console. For example, running Notepad.exe then running exit, then tab closes normally. For unknown reason, Code.exe (and possibly, all Electron-based programs) did not break away from the console?
Does this issue occur when all extensions are disabled?: Yes
6f17636121051a53c88d3e605c491d22af2ba755, x64Steps to Reproduce:
code; exit.Expected behavior: Step 3, the console or the terminal tab should exit.
Steps to Reproduce (continued):
code, then close the console or the terminal tab using theXbutton.code; exit.There are other things to try, such as using
code path-to-dirorcode path-to-file. A simple description consistent with what I observe in all those trials:codecommand opens a new window (file or directory or just runningcode), then it will block the console host or the terminal from shutting down, until the newly opened window is closed.codecommand did not open a new window, then it will not block the console host or the terminal from shutting down.Psychic debugging:
codecommand startsCode.exe(forcli.js). Let's call the started processCode[1]. It is monitored by the terminal tab.Code[1]determines a new window is not needed, it communicates the action to an existing window, andCode[1]terminates (unless--waitis specified). This means if thecodecommand did not open a new window, then it will not block tab close.Code[1]determines a new window is needed, it will launch some otherCode.exeinstances. For reason unknown to me, one of them (I suspectCode[1]does, also it seems to be the one hosting GUI) causes the terminal tab to wait upon closing.Normally, a GUI-subsystem program should be detached from the console. For example, running
Notepad.exethen runningexit, then tab closes normally. For unknown reason,Code.exe(and possibly, all Electron-based programs) did not break away from the console?