Ctrl+C (interrupt) seems hardcoded and non remappable using msys2-bash #11724

Closed
opened 2026-01-31 02:55:47 +00:00 by claunia · 2 comments
Owner

Originally created by @csdvrx on GitHub (Dec 7, 2020).

Environment

Latest versions available: Windows 20H2 + Windows Terminal Dev (1.5.3242.0)

Latest msys2 with default installation in C:\msys64 started with:
"commandline": "C:/msys64/usr/bin/env.exe MSYS=winsymlinks:nativestrict MSYSTEM=MSYS /bin/bash.exe --login -i",

GNU bash, version 4.4.23(2)-release (x86_64-pc-msys)

Steps to reproduce

Redefine interrupt on a new bash with:

stty intr ^X

Expected behavior

In mintty and other terminals, after stty intr ^X the interrupt definition and key sequence are both remapped, therefore:

  • press ctrl-c : nothing happens

  • press ctrl-x : ^X is shown and interrupt is sent

Actual behavior

However, in Windows Terminal, after stty intr ^X only the interrupt definition is changed:

  • press ctrl-x : nothing happens

  • press ctrl-c : ^X is shown and interrupt is sent

This is the exact opposite, and an undesirable behavior for any terminal application that voluntarily remaps Ctrl-C to a less common sequence, for example to prevent user interruption.

It suggests Ctrl-C is hardcoded somewhere to always generate interrupt, which will then send whatever the sequence defined by stty is, instead of using stty definition to also change the configured value and to match stty definition

Likely related to #4958, where Ctrl-Z is being processed even in raw mode, and pointing to deeper issues

Originally created by @csdvrx on GitHub (Dec 7, 2020). # Environment Latest versions available: Windows 20H2 + Windows Terminal Dev (1.5.3242.0) Latest msys2 with default installation in C:\msys64 started with: "commandline": "C:/msys64/usr/bin/env.exe MSYS=winsymlinks:nativestrict MSYSTEM=MSYS /bin/bash.exe --login -i", GNU bash, version 4.4.23(2)-release (x86_64-pc-msys) # Steps to reproduce Redefine interrupt on a new bash with: stty intr ^X # Expected behavior In mintty and other terminals, after stty intr ^X the interrupt definition and key sequence are both remapped, therefore: - press ctrl-c : nothing happens - press ctrl-x : ^X is shown and interrupt is sent # Actual behavior However, in Windows Terminal, after stty intr ^X only the interrupt definition is changed: - press ctrl-x : nothing happens - press ctrl-c : ^X is shown and interrupt is sent This is the exact opposite, and an undesirable behavior for any terminal application that voluntarily remaps Ctrl-C to a less common sequence, for example to prevent user interruption. It suggests Ctrl-C is hardcoded somewhere to always generate interrupt, which will then send whatever the sequence defined by stty is, instead of using stty definition to also change the configured value and to match stty definition Likely related to #4958, where Ctrl-Z is being processed even in raw mode, and pointing to deeper issues
claunia added the Needs-TriageNeeds-Tag-FixNeeds-Author-Feedback labels 2026-01-31 02:55:47 +00:00
Author
Owner

@zadjii-msft commented on GitHub (Dec 8, 2020):

Does this repro with the legacy console host too (conhost.exe, which you launch when running cmd.exe or any other commandline app directly)? Or is this just a Terminal problem?

@zadjii-msft commented on GitHub (Dec 8, 2020): Does this repro with the legacy console host too (`conhost.exe`, which you launch when running `cmd.exe` or any other commandline app directly)? Or is this _just_ a Terminal problem?
Author
Owner

@DHowett commented on GitHub (Dec 8, 2020):

The Windows console host--in any configuration (running inside Terminal or outside of it)--does not support tty line disciplines or any of the tty IOCTLs TGSETS TCSETSW TCSETSF TIOCSWINSZ TCSBRK TIOCSBRK (...). This is entirely emulated by the MSYS runtime. The bug, therefore, is in their emulation.

mintty is not a good comparison terminal, because unfortunately msys and mintty have an internal contract that they can rely on when they're used together. That means they don't have to use the Console APIs, and that they are not bound by their limitations.

@DHowett commented on GitHub (Dec 8, 2020): The Windows console host--in any configuration (running inside Terminal or outside of it)--does not support tty line disciplines or any of the tty IOCTLs `TGSETS` `TCSETSW` `TCSETSF` `TIOCSWINSZ` `TCSBRK` `TIOCSBRK` (...). This is entirely emulated by the MSYS runtime. The bug, therefore, is in their emulation. mintty is not a good comparison terminal, because unfortunately msys and mintty have an internal contract that they can rely on when they're used together. That means they don't have to use the Console APIs, and that they are not bound by their limitations.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#11724