-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Global CLI tools creates a orphaned cmd.exe process when CTRL+C is pressed to exit #8959
Comments
I need to dig more on this |
This is why |
Did some quick research. Doesn't look like this avoidable when using cmd.exe. All the suggestions I've seen to get around this is to invoke something other than cmd.exe. http://h4ck3r.net/2013/07/21/suppress-terminate-batch-job/ |
@livarcocc @wli3 I know time is winding down on preview1, so I'd like to re-emphasize this bug causes the console to become unresponsive, even after repeated CTRL+C presses. I can't use dotnet-watch myself as a global tool because of this. Please take a look at dotnet/cli#8384. I don't know of any other solution than to just not use cmd.exe cc @muratg |
cc @danroth27 |
My apologies for missing this, thanks for the ping @danroth27. I will discuss this with @livarcocc this afternoon. |
this line is the real problem. It is not .cmd file alone. It is .cmd + how CLI create "Command" (start a new .cmd process) If you directly call "dotnet-watch" it will not create the orphan process. |
Per PowerShell/PowerShell#11314 we are seeing this now with Scoop, Chocolatey, and most importantly PowerShell Core when installed as a Global Tool (which is the default recommended way per the docs) when used with the Windows Terminal. Windows Terminal now adds .NET Global Tool-installed pwsh (which is becoming quite popular) and simply running it (via the global tool shim) and then pressing ctrl+c stops everything and orphans the process. |
@KathleenDollard can we reopen? |
@shanselman this is not the same issue. Powershell non global tools distribution has a different exe with special handing in it. |
Current understanding of the problem: The reason this occurs is that normal Ctl-C handling by the AppHost used for all .NET Core runtime-dependent and self-contained applications can be adversely affected by the application itself. For example, a child-process it needs to not swallow the Ctl-C keypress. Because this Ctl-C issue is due to the application behavior, it will occur regardless of how the runtime-dependent version of PowerShell is delivered. The non-runtime-dependent variants of PowerShell are, of course, not affected. Suggestions for a fix has been passed on, so we expect PowerShell to be fixed in response to PowerShell/PowerShell#11314 so I am not reopening this issue. |
Steps to reproduce
dotnet-watch.2.1.0-preview1-t000.nupkg.zip
dotnet install tool
#8940 is fixed)Expected behavior
This should force-quit the global CLI tool, including any parent processes.
Actual behavior
The cmd.exe process started to launch %USERPROFILE%/.dotnet/tools/dotnet-watch.cmd is orphaned.
Before CTRL+C:
After:
The "Terminate batch job (Y/N) question appears, but I cannot give it a response because the parent dotnet.exe process died.
Process 22736 was orphaned
Environment data
Shell: Happens using Command Prompt, Powershell 5, or ConEmu + cmd or powershell.
dotnet --info
output:cc @wli3 @anurse
The text was updated successfully, but these errors were encountered: