Cannot close a running program via CTRL+C shortcut #11065

Closed
opened 2026-01-31 02:37:41 +00:00 by claunia · 7 comments
Owner

Originally created by @H4kt on GitHub (Oct 18, 2020).

Environment

Windows build number:  10.0.19041.450
Windows Terminal version (if applicable): 1.3.2651.0 

Steps to reproduce

Run any long-running terminal program such as ping <address> -t
Press CTRL+C on your keyboard

Expected behavior

Terminal window should stay opened, but ping process should be stopped

Actual behavior

Terminal window closes

Originally created by @H4kt on GitHub (Oct 18, 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: 10.0.19041.450 Windows Terminal version (if applicable): 1.3.2651.0 ``` # Steps to reproduce Run any long-running terminal program such as `ping <address> -t` Press `CTRL+C` on your keyboard # Expected behavior Terminal window should stay opened, but ping process should be stopped # Actual behavior Terminal window closes
claunia added the Issue-QuestionNeeds-Tag-FixResolution-AnsweredProduct-Terminal labels 2026-01-31 02:37:41 +00:00
Author
Owner

@skyline75489 commented on GitHub (Oct 19, 2020):

See #198, #6258

@skyline75489 commented on GitHub (Oct 19, 2020): See #198, #6258
Author
Owner

@jdebp commented on GitHub (Oct 19, 2020):

I cannot reproduce this with version 1.3.2651.0. The terminal window happily remains open. You're likely going to need to provide more detailed steps for reproducing this.

PS C:\> ping 127.0.0.1 -t

Pinging 127.0.0.1 with 32 bytes of data:
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128

Ping statistics for 127.0.0.1:
    Packets: Sent = 3, Received = 3, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 0ms, Average = 0ms
Control-C
PS C:\>
@jdebp commented on GitHub (Oct 19, 2020): I cannot reproduce this with version 1.3.2651.0. The terminal window happily remains open. You're likely going to need to provide more detailed steps for reproducing this. ``` PS C:\> ping 127.0.0.1 -t Pinging 127.0.0.1 with 32 bytes of data: Reply from 127.0.0.1: bytes=32 time<1ms TTL=128 Reply from 127.0.0.1: bytes=32 time<1ms TTL=128 Reply from 127.0.0.1: bytes=32 time<1ms TTL=128 Ping statistics for 127.0.0.1: Packets: Sent = 3, Received = 3, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 0ms, Maximum = 0ms, Average = 0ms Control-C PS C:\> ```
Author
Owner

@zadjii-msft commented on GitHub (Oct 19, 2020):

@H4kt could you share the profile you're using to run ping? it sounds like ping is exiting cleanly, and then the Terminal is automatically closing, because the client closed. Does this repro if you run cmd.exe as the commandline, then run ping from that prompt?

@zadjii-msft commented on GitHub (Oct 19, 2020): @H4kt could you share the profile you're using to run `ping`? it sounds like ping is exiting cleanly, and then the Terminal is automatically closing, because the client closed. Does this repro if you run `cmd.exe` as the commandline, then run `ping` from that prompt?
Author
Owner

@H4kt commented on GitHub (Oct 19, 2020):

Oh, silly me.
Yeah, the cmd is starting via gsudo to be elevated and that causes the problem.
However I'd like to know if there is another way to open an elevated cmd in terminal which will handle the CTRL+C input correctly?

@H4kt commented on GitHub (Oct 19, 2020): Oh, silly me. Yeah, the cmd is starting via gsudo to be elevated and that causes the problem. However I'd like to know if there is another way to open an elevated cmd in terminal which will handle the CTRL+C input correctly?
Author
Owner

@zadjii-msft commented on GitHub (Oct 19, 2020):

Right now, no. I'd take a look at #632, #1032, #5000 et. al for why mixed elevation is hard. You could probably just get away with "closeOnExit": "never" in your settings though. That'll prevent the Terminal from auto-closing when the client application exits, even gracefully.

@zadjii-msft commented on GitHub (Oct 19, 2020): Right now, no. I'd take a look at #632, #1032, #5000 et. al for why mixed elevation is hard. You could probably just get away with `"closeOnExit": "never"` in your settings though. That'll prevent the Terminal from auto-closing when the client application exits, even gracefully.
Author
Owner

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

If you're using gsudo cmd or gsudo powershell, and not just gsudo ping, and Ctrl+C is terminating your session.... you're going to have to file a bug on gsudo for not handling ^C correctly.

@DHowett commented on GitHub (Oct 19, 2020): If you're using `gsudo cmd` or `gsudo powershell`, and not just `gsudo ping`, _and_ <kbd>Ctrl+C</kbd> is terminating your session.... you're going to have to file a bug on gsudo for not handling ^C correctly.
Author
Owner

@gerardog commented on GitHub (Nov 12, 2020):

Hi @H4kt,
This was an issue in gsudo (gerardog/gsudo#53) and was fixed in v0.7.2, in early August. Please update gsudo.

@gerardog commented on GitHub (Nov 12, 2020): Hi @H4kt, This was an issue in gsudo (gerardog/gsudo#53) and was fixed in v0.7.2, in early August. Please update gsudo.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#11065