Skip to content
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

Exiting from cmd.exe within bash with Ctrl+C scrambles keyboard input inside any new cmd.exe instances launched from the same bash #2021

Closed
CherryDT opened this issue Apr 27, 2017 · 2 comments

Comments

@CherryDT
Copy link

CherryDT commented Apr 27, 2017

I have build 15063.138.

Steps to reproduce:

  • Open bash.
  • Start cmd.exe.
  • Press Ctrl+C. [This is what triggers the issue.]
  • Start cmd.exe.
  • Try running commands.

All keyboard input is totally garbled from now on. It appears correctly when entering, but the shell seems to receive the characters I entered in some random order. This happens in any cmd.exe you launch from the current bash. Only closing bash fixes it.

This also happens from xterm.

image

image

At first I thought it is just omitting characters, but then I noticed that in subsequent tries, characters from previous commands may show up too:

image

Actually, I think it shouldn't even exit cmd.exe when I press Ctrl+C. I think Ctrl+C should be processed by cmd.exe as usually (just like it would when starting cmd.exe from cmd.exe in Windows, or bash from bash in Linux).

@CherryDT CherryDT changed the title Exiting from cmd.exe within bash with Ctrl+C scrambles keyboard input inside any new cmd.exe instances inside the same bash Exiting from cmd.exe within bash with Ctrl+C scrambles keyboard input inside any new cmd.exe instances launched from the same bash Apr 27, 2017
@benhillis benhillis added the bug label Jun 6, 2017
@zadjii-msft
Copy link
Member

Okay, I have figured something out. It looks like when ^C is used to interrupt the cmd.exe process, it's not killed. It's still attached to the console handles. Then, when you launch another cmd.exe, both of them are sharing the input handle, and they each only get half of the input (at random).

image
In this screenshot, you can see that there are two different cmd's attached, one in c:\ and the other in C:\Windows\System32

image
In this screenshot, you can see that there are two Windows Command Processor (cmd.exe) processes in the Ubuntu instance.

@zadjii-msft zadjii-msft added duplicate and removed bug labels Jul 14, 2017
@zadjii-msft
Copy link
Member

I spoke with @benhillis offline about this. Turns out this is a dupe to #1614. I'm gonna close this issue as a dupe then.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants