CTRL + C kills entire terminal tab #6850

Closed
opened 2026-01-31 00:48:49 +00:00 by claunia · 16 comments
Owner

Originally created by @oledid on GitHub (Mar 13, 2020).

Environment

Microsoft Windows NT 10.0.18363.0
Windows Terminal (Preview) Version: 0.9.433.0
PowerShell Core 7.0.0

Steps to reproduce

When running a long-running or infinite task from powershell, for example a watch-task for building and compiling, and I press "CTRL + C", the entire powershell process exits, and I have to create a new tab and navigate to the correct folder to be "where I was" before pressing "CTRL + C".

Expected behavior

I would expect that "CTRL + C" would kill the long running process which was run from powershell, and not the entire powershell terminal tab. I would expect to return to powershell in the current working directory.

Actual behavior

The entire tab stops and prints [process exited with code XXXXX]

test
(here I press CTRL + C right after [nodemon] clean exit - waiting for changes before restart)

Originally created by @oledid on GitHub (Mar 13, 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 Microsoft Windows NT 10.0.18363.0 Windows Terminal (Preview) Version: 0.9.433.0 PowerShell Core 7.0.0 # Steps to reproduce When running a long-running or infinite task from powershell, for example a watch-task for building and compiling, and I press "CTRL + C", the entire powershell process exits, and I have to create a new tab and navigate to the correct folder to be "where I was" before pressing "CTRL + C". # Expected behavior I would expect that "CTRL + C" would kill the long running process which was run from powershell, and not the entire powershell terminal tab. I would expect to return to powershell in the current working directory. # Actual behavior The entire tab stops and prints [process exited with code XXXXX] ![test](https://user-images.githubusercontent.com/1911049/76601972-47fc0b00-650a-11ea-878d-6a37610194a1.gif) (here I press CTRL + C right after ```[nodemon] clean exit - waiting for changes before restart```)
claunia added the Resolution-ExternalNeeds-Tag-Fix labels 2026-01-31 00:48:50 +00:00
Author
Owner

@DHowett-MSFT commented on GitHub (Mar 13, 2020):

How did you install powershell 7?

@DHowett-MSFT commented on GitHub (Mar 13, 2020): How did you install powershell 7?
Author
Owner

@oledid commented on GitHub (Mar 13, 2020):

@DHowett-MSFT with scoop, https://scoop.sh, «scoop install pwsh» probably

@oledid commented on GitHub (Mar 13, 2020): @DHowett-MSFT with scoop, https://scoop.sh, «scoop install pwsh» probably
Author
Owner

@DHowett-MSFT commented on GitHub (Mar 13, 2020):

This is very similar to https://github.com/PowerShell/PowerShell/issues/11314, but scoop needs to fix it on their end. Same exact problem. I can’t find the bug on their tracker right now, but somebody did file it. 😄

@DHowett-MSFT commented on GitHub (Mar 13, 2020): This is very similar to https://github.com/PowerShell/PowerShell/issues/11314, but scoop needs to fix it on their end. Same exact problem. I can’t find the bug on their tracker right now, but somebody did file it. 😄
Author
Owner

@oledid commented on GitHub (Mar 13, 2020):

Thanks!

If other people are reading this, the solution is to change the exe being used, in windows terminal's profiles.json:

"commandline": "C:\\Users\\username\\scoop\\apps\\pwsh\\current\\pwsh.exe",
@oledid commented on GitHub (Mar 13, 2020): Thanks! If other people are reading this, the solution is to change the exe being used, in windows terminal's `profiles.json`: ```json "commandline": "C:\\Users\\username\\scoop\\apps\\pwsh\\current\\pwsh.exe", ```
Author
Owner

@jorgensigvardsson commented on GitHub (Mar 17, 2020):

Thanks!

If other people are reading this, the solution is to change the exe being used, in windows terminal's profiles.json:

"commandline": "C:\\Users\\username\\scoop\\apps\\pwsh\\current\\pwsh.exe",

So, I've installed it as a global dotnet tool. How do I solve it? This is causing neural damage... I've become wary of using Ctrl+C. 😖

@jorgensigvardsson commented on GitHub (Mar 17, 2020): > Thanks! > > If other people are reading this, the solution is to change the exe being used, in windows terminal's `profiles.json`: > > ```json > "commandline": "C:\\Users\\username\\scoop\\apps\\pwsh\\current\\pwsh.exe", > ``` So, I've installed it as a global dotnet tool. How do I solve it? This is causing neural damage... I've become wary of using Ctrl+C. :confounded:
Author
Owner

@oledid commented on GitHub (Mar 17, 2020):

@jorgensigvardsson I haven't done that, but the problem for the scoop installation was that the pwsh.exe in PATH was a shimmed .exe, which did not work. If I changed to the real .exe, it worked. Maybe the global dotnet tool-installation also has another shim .exe? Check what you have in PATH when you run where.exe pwsh

@oledid commented on GitHub (Mar 17, 2020): @jorgensigvardsson I haven't done that, but the problem for the scoop installation was that the pwsh.exe in PATH was a [shimmed](https://en.wikipedia.org/wiki/Shim_(computing)) .exe, which did not work. If I changed to the real .exe, it worked. Maybe the global dotnet tool-installation also has another shim .exe? Check what you have in PATH when you run `where.exe pwsh`
Author
Owner

@oledid commented on GitHub (Mar 17, 2020):

Or locate the installation directory and see if there is another exe there

@oledid commented on GitHub (Mar 17, 2020): Or locate the installation directory and see if there is another exe there
Author
Owner

@jorgensigvardsson commented on GitHub (Mar 17, 2020):

@oledid I only find pwsh.exe in my global dotnet directory C:\Users\user\.dotnet\tools. Maybe I should install it as a "real" application as well.

@jorgensigvardsson commented on GitHub (Mar 17, 2020): @oledid I only find `pwsh.exe` in my global dotnet directory `C:\Users\user\.dotnet\tools`. Maybe I should install it as a "real" application as well.
Author
Owner

@oledid commented on GitHub (Mar 17, 2020):

@jorgensigvardsson Yeah, maybe. Post it here if you find out :)

@oledid commented on GitHub (Mar 17, 2020): @jorgensigvardsson Yeah, maybe. Post it here if you find out :)
Author
Owner

@jorgensigvardsson commented on GitHub (Mar 17, 2020):

@oledid I downloaded the Power Shell 7 distribution for Windows x64, and Ctrl+C now works as expected. I hope my neurons will recover in time. 😀

@jorgensigvardsson commented on GitHub (Mar 17, 2020): @oledid I downloaded the Power Shell 7 distribution for Windows x64, and Ctrl+C now works as expected. I hope my neurons will recover in time. 😀
Author
Owner

@jorgensigvardsson commented on GitHub (Mar 17, 2020):

And thank you very much for your help @oledid!

@jorgensigvardsson commented on GitHub (Mar 17, 2020): And thank you very much for your help @oledid!
Author
Owner

@oledid commented on GitHub (Mar 17, 2020):

@jorgensigvardsson No prob, the problem made me pretty crazy too :)

@oledid commented on GitHub (Mar 17, 2020): @jorgensigvardsson No prob, the problem made me pretty crazy too :)
Author
Owner

@Livven commented on GitHub (Mar 21, 2020):

FWIW this is the scoop issue: https://github.com/lukesampson/scoop/issues/3634 @DHowett-MSFT

@Livven commented on GitHub (Mar 21, 2020): FWIW this is the scoop issue: https://github.com/lukesampson/scoop/issues/3634 @DHowett-MSFT
Author
Owner

@CHerSun commented on GitHub (Jul 15, 2020):

Thank you @oledid . Just a small note: when configuring pwsh installed using Scoop in Windows Terminal replace line:
"source": "Windows.Terminal.PowershellCore",
with
"commandline": "%USERPROFILE%\\scoop\\apps\\pwsh\\current\\pwsh.exe",
if you are using default Scoop installation path.

To add icon:
"icon": "%USERPROFILE%\\scoop\\apps\\pwsh\\current\\assets\\StoreLogo.png",

@CHerSun commented on GitHub (Jul 15, 2020): Thank you @oledid . Just a small note: when configuring `pwsh` installed using **Scoop** in Windows Terminal replace line: `"source": "Windows.Terminal.PowershellCore",` with `"commandline": "%USERPROFILE%\\scoop\\apps\\pwsh\\current\\pwsh.exe",` if you are using default Scoop installation path. To add icon: ` "icon": "%USERPROFILE%\\scoop\\apps\\pwsh\\current\\assets\\StoreLogo.png",`
Author
Owner

@AndrewSav commented on GitHub (Jan 8, 2022):

Alternatively scoop config shim kiennq seems to also work, after that you need to recreate the shim with scoop update -f pwsh

@AndrewSav commented on GitHub (Jan 8, 2022): Alternatively `scoop config shim kiennq` seems to also work, after that you need to recreate the shim with `scoop update -f pwsh`
Author
Owner

@Spinks90 commented on GitHub (Jan 31, 2022):

I know it's an old post but hopefully, this will help someone out. My JSON config was missing the keybindings.

   // Add custom keybindings to this array.
    // To unbind a key combination from your defaults.json, set the command to "unbound".
    // To learn more about keybindings, visit https://aka.ms/terminal-keybindings
    "keybindings":
    [
        // Copy and paste are bound to Ctrl+Shift+C and Ctrl+Shift+V in your defaults.json.
        // These two lines additionally bind them to Ctrl+C and Ctrl+V.
        // To learn more about selection, visit https://aka.ms/terminal-selection
        { "command": {"action": "copy", "singleLine": false }, "keys": "ctrl+c" },
        { "command": "paste", "keys": "ctrl+v" },

        // Press Ctrl+Shift+F to open the search box
        { "command": "find", "keys": "ctrl+shift+f" },

        // Press Alt+Shift+D to open a new pane.
        // - "split": "auto" makes this pane open in the direction that provides the most surface area.
        // - "splitMode": "duplicate" makes the new pane use the focused pane's profile.
        // To learn more about panes, visit https://aka.ms/terminal-panes
        { "command": { "action": "splitPane", "split": "auto", "splitMode": "duplicate" }, "keys": "alt+shift+d" }
    ]

Hope this helps someone!

@Spinks90 commented on GitHub (Jan 31, 2022): I know it's an old post but hopefully, this will help someone out. My JSON config was missing the keybindings. ``` // Add custom keybindings to this array. // To unbind a key combination from your defaults.json, set the command to "unbound". // To learn more about keybindings, visit https://aka.ms/terminal-keybindings "keybindings": [ // Copy and paste are bound to Ctrl+Shift+C and Ctrl+Shift+V in your defaults.json. // These two lines additionally bind them to Ctrl+C and Ctrl+V. // To learn more about selection, visit https://aka.ms/terminal-selection { "command": {"action": "copy", "singleLine": false }, "keys": "ctrl+c" }, { "command": "paste", "keys": "ctrl+v" }, // Press Ctrl+Shift+F to open the search box { "command": "find", "keys": "ctrl+shift+f" }, // Press Alt+Shift+D to open a new pane. // - "split": "auto" makes this pane open in the direction that provides the most surface area. // - "splitMode": "duplicate" makes the new pane use the focused pane's profile. // To learn more about panes, visit https://aka.ms/terminal-panes { "command": { "action": "splitPane", "split": "auto", "splitMode": "duplicate" }, "keys": "alt+shift+d" } ] ``` Hope this helps someone!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#6850