Ctrl+C doen't stop a program in windows terminal powershell console. #9075

Closed
opened 2026-01-31 01:45:17 +00:00 by claunia · 7 comments
Owner

Originally created by @xchern on GitHub (Jun 17, 2020).

Environment

Windows build number:
Platform ServicePack Version      VersionString
-------- ----------- -------      -------------
 Win32NT             10.0.18362.0 Microsoft Windows NT 10.0.18362.0

Windows Terminal version (if applicable):
Version: 1.0.1401.0

Any other software?
Windows built-in ssh:
PS> ssh -V
OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5

Steps to reproduce

  1. open a powershell window.
  2. try to connect a ssh sever with ssh, press Ctrl+C to quit when it ask for password.
  3. run a endless program, for example ping bing.com /t, which will not quit by itself. Ctrl+C doesn't end the program.

Expected behavior

Ctrl+C should end the running program.

Actual behavior

Ctrl+C does not end the program.

Originally created by @xchern on GitHub (Jun 17, 2020). <!-- 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 I ACKNOWLEDGE THE FOLLOWING BEFORE PROCEEDING: 1. If I delete this entire template and go my own path, the core team may close my issue without further explanation or engagement. 2. If I list multiple bugs/concerns in this one issue, the core team may close my issue without further explanation or engagement. 3. If I write an issue that has many duplicates, the core team may close my issue without further explanation or engagement (and without necessarily spending time to find the exact duplicate ID number). 4. If I leave the title incomplete when filing the issue, the core team may close my issue without further explanation or engagement. 5. If I file something completely blank in the body, the core team may close my issue without further explanation or engagement. All good? Then proceed! --> <!-- This bug tracker is monitored by Windows Terminal development team and other technical folks. **Important: When reporting BSODs or security issues, DO NOT attach memory dumps, logs, or traces to Github issues**. Instead, send dumps/traces to secure@microsoft.com, referencing this GitHub issue. If this is an application crash, please also provide a Feedback Hub submission link so we can find your diagnostic data on the backend. Use the category "Apps > Windows Terminal (Preview)" and choose "Share My Feedback" after submission to get the link. Please use this form and describe your issue, concisely but precisely, with as much detail as possible. --> # Environment ```none Windows build number: Platform ServicePack Version VersionString -------- ----------- ------- ------------- Win32NT 10.0.18362.0 Microsoft Windows NT 10.0.18362.0 Windows Terminal version (if applicable): Version: 1.0.1401.0 Any other software? Windows built-in ssh: PS> ssh -V OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5 ``` # Steps to reproduce 1. open a powershell window. 2. try to connect a ssh sever with ssh, press Ctrl+C to quit when it ask for password. 3. run a endless program, for example `ping bing.com /t`, which will not quit by itself. Ctrl+C doesn't end the program. # Expected behavior Ctrl+C should end the running program. # Actual behavior Ctrl+C does not end the program.
claunia added the Resolution-ExternalNeeds-Tag-FixNeeds-Attention labels 2026-01-31 01:45:17 +00:00
Author
Owner

@xchern commented on GitHub (Jun 17, 2020):

After more test, I noticed this is probably a powershell bug. The same operation in cmd has no problem.

@xchern commented on GitHub (Jun 17, 2020): After more test, I noticed this is probably a powershell bug. The same operation in cmd has no problem.
Author
Owner

@finsterdexter commented on GitHub (Jun 17, 2020):

What version of Powershell were you using? Powershell Core v7? Something else?

I am seeing this issue in Terminal, as well, while running a long running task. The tab seems to crash with [process exited with code 3221225786] when I press Ctrl-C, and the program keeps running in background.

My env:
Windows 10 Pro 19041.329
same version of Terminal (1.0.1401.0)
This is happening in a Powershell Core tab, Powershell Core v7.0.2

If I run my task in a standalone Powershell Core window, I do not see this behavior, and Ctrl-C works as expected, i.e. shuts down the task gracefully. It only happens to me in Terminal. In my case, I'm running a docker-compose process using Docker Desktop v2.3.0.3

@finsterdexter commented on GitHub (Jun 17, 2020): What version of Powershell were you using? Powershell Core v7? Something else? I am seeing this issue in Terminal, as well, while running a long running task. The tab seems to crash with `[process exited with code 3221225786]` when I press Ctrl-C, and the program keeps running in background. My env: Windows 10 Pro 19041.329 same version of Terminal (1.0.1401.0) This is happening in a Powershell Core tab, Powershell Core v7.0.2 If I run my task in a standalone Powershell Core window, I do not see this behavior, and Ctrl-C works as expected, i.e. shuts down the task gracefully. It only happens to me in Terminal. In my case, I'm running a docker-compose process using Docker Desktop v2.3.0.3
Author
Owner

@DHowett commented on GitHub (Jun 17, 2020):

I am seeing this issue in Terminal, as well, while running a long running task. The tab seems to crash with [process exited with code 3221225786] when I press Ctrl-C, and the program keeps running in background.

This is a totally different issue. You have either installed PowerShell Core via Scoop or as a dotnet global tool before v7.0 came out. More info here (dotnet) https://github.com/PowerShell/PowerShell/issues/11314 and (scoop) https://github.com/lukesampson/scoop/issues/3634.

I'm going to mark this comment and yours as "off-topic"; if you continue running into this issue after investigating the dotnet/scoop bug reports, please file a new issue.

@DHowett commented on GitHub (Jun 17, 2020): > I am seeing this issue in Terminal, as well, while running a long running task. The tab seems to crash with [process exited with code 3221225786] when I press Ctrl-C, and the program keeps running in background. This is a totally different issue. You have either installed PowerShell Core via Scoop or as a dotnet global tool before v7.0 came out. More info here (dotnet) https://github.com/PowerShell/PowerShell/issues/11314 and (scoop) https://github.com/lukesampson/scoop/issues/3634. I'm going to mark this comment and yours as "off-topic"; if you continue running into this issue after investigating the dotnet/scoop bug reports, please _file a new issue._
Author
Owner

@DHowett commented on GitHub (Jun 17, 2020):

@xiaosong0911 Are you using any other software in the affected tabs? Sometimes when you run "ssh" in the same window, ssh disables Ctrl+C.

@DHowett commented on GitHub (Jun 17, 2020): @xiaosong0911 Are you using any other software in the affected tabs? Sometimes when you run "ssh" in the same window, ssh disables <kbd>Ctrl+C</kbd>.
Author
Owner

@xchern commented on GitHub (Jun 19, 2020):

@xiaosong0911 Are you using any other software in the affected tabs? Sometimes when you run "ssh" in the same window, ssh disables Ctrl+C.

I only used "ssh" and "ping" as described in the steps to reproduce. I have no idea how ssh can disable Ctrl+C.

BTW, I noticed this problem also occurs in the windows' built-in powershell window, so it is probably a bug of powershell or ssh rather than windows terminal.

@xchern commented on GitHub (Jun 19, 2020): > @xiaosong0911 Are you using any other software in the affected tabs? Sometimes when you run "ssh" in the same window, ssh disables Ctrl+C. I only used "ssh" and "ping" as described in the steps to reproduce. I have no idea how ssh can disable `Ctrl+C`. BTW, I noticed this problem also occurs in the windows' built-in powershell window, so it is probably a bug of powershell or ssh rather than windows terminal.
Author
Owner

@DHowett commented on GitHub (Jun 19, 2020):

Yes, there is an API that globally disables Ctrl+C for the whole console window. SSH uses it, sometimes, and does not enable it again.

@DHowett commented on GitHub (Jun 19, 2020): Yes, there is an API that globally disables Ctrl+C for the whole console window. SSH uses it, sometimes, and does not enable it again.
Author
Owner

@DHowett commented on GitHub (Jun 19, 2020):

Thanks!

@DHowett commented on GitHub (Jun 19, 2020): Thanks!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#9075