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

CTRL+Z doesn't work in Bash #1569

Closed
bitcrazed opened this issue Jan 4, 2017 · 52 comments
Closed

CTRL+Z doesn't work in Bash #1569

bitcrazed opened this issue Jan 4, 2017 · 52 comments
Assignees
Labels

Comments

@bitcrazed
Copy link
Contributor

bitcrazed commented Jan 4, 2017

Issue: In Windows 10 Insider build 15002, when running Bash.exe, CTRL + chords are not being correctly handled by the Windows Console.

Effect: Users will be unable to terminate Linux apps using CTRL + C, or background running tasks using CTRL + Z, etc. When CTRL + C is hit in Bash, a ‘c’ is displayed in the bash console.

Work-Around(s): Until fixed:

  1. Run Linux tools that require CTRL + C to terminate in a separate Bash console session; these individual bash consoles can then be closed when needed without disrupting your interactive bash consoles
  2. Map an alternate key to Ctrl+C. For example, to map Ctrl+K to Ctrl+C run: stty intr \^k. This mapping is per terminal and will have to be done every time bash is launched. Users can include this in their .bashrc if preferred

Scope: This issue only affects Bash sessions and does not prevent CTRL + C, etc. in other console apps or shells (i.e. Cmd or PowerShell).

For more information on this release, including the many other fixes it DOES include, be sure to read the build 15002 Release Notes.

We apologize for this annoying issue. A fix has been checked-in and will be released ASAP into an up-coming Insiders build.

@bitcrazed bitcrazed self-assigned this Jan 4, 2017
@bitcrazed bitcrazed changed the title Ignore Placeholder Jan 4, 2017
@microsoft microsoft locked and limited conversation to collaborators Jan 7, 2017
@bitcrazed bitcrazed changed the title Placeholder CTRL+C etc. don't work in Bash in Insider build 15002 Jan 10, 2017
@bitcrazed bitcrazed changed the title CTRL+C etc. don't work in Bash in Insider build 15002 CTRL+C doesn't work in Bash in Insider build 15002 Jan 10, 2017
@microsoft microsoft unlocked this conversation Jan 10, 2017
@krzysztofantczak
Copy link

Still works like a charm under wsl-terminal https://github.com/goreliu/wsl-terminal ;-)

@Warblefly
Copy link

Warblefly commented Jan 14, 2017

Thank you. It'll be great to have that fix in the system. For now, I've mapped CTRL-C to CTRL-P; which is how PR1MOS computers at my university handled 'interrupt' 35 years ago. Can't beat nostalgia.

@seancorfield
Copy link

A fellow Surrey graduate -- small world!

@benhillis Do we have a scheduled release date for this fix? Thanks!

@fpqc
Copy link

fpqc commented Jan 14, 2017

@seancorfield No, we generally don't get notice for when the next insider build gets flighted. And the team here doesn't control it. Ask @DonaSarkar on twitter maybe.

@benhillis
Copy link
Member

I'm hoping next week's build has the fix.

@seancorfield
Copy link

Fixed in 15014 it seems. Thank you!

@fpqc
Copy link

fpqc commented Jan 22, 2017

tfw 15014 broke my xbox controller though >.< ( just a warning, it's a known issue )

@davidmaxwaterman
Copy link

Does this fix ctrl-z too? I've just upgraded to CU/15063.138, and ctrl-z has stopped working - it used to work in 14393.969, so it is a regression.

@sunilmut
Copy link
Member

@davidmaxwaterman - Thanks for the report. We are looking into it.

@davidmaxwaterman
Copy link

Fwiw, I have since noticed it works from within vim, but not in bash.

@sunilmut
Copy link
Member

@davidmaxwaterman - We have found the bug. We are prioritizing it and working to get it fixed. Apologies for breaking such a basic scenario.

@EricPell
Copy link

Also having ongoing issues with ctrl-z

@fpqc
Copy link

fpqc commented May 28, 2017

Yeah, seems like the kind of thing that would really drive people nuts and turn them off from using WSL, especially since it's a regression.

@maierl
Copy link

maierl commented May 31, 2017

WSL without Ctrl+Z is similar to Windows without right click. You can work around it, but you cannot expect to win any customers with it.

@sunilmut
Copy link
Member

sunilmut commented Jun 1, 2017

Thanks all for chiming in. The bug has been approved for Creators Update servicing.

@EricPell
Copy link

EricPell commented Jun 1, 2017

@sunilmut That's great news. Thanks for the attention.

@davidmaxwaterman
Copy link

I don't think it was in yesterday's updates...was I overly optimistic?

@sunilmut
Copy link
Member

@davidmaxwaterman - Possibly. The fix has to go through the test cycle of the servicing process. I know the fix is on it's way out. Probably, by the end of the month. Thanks for your patience.

@giech
Copy link

giech commented Jul 13, 2017

I believe the fix was in the latest Patch Tuesday, but the release notes do not mention it: (KB4025342). Could someone please confirm and close the issue, if that is the case?

@maierl
Copy link

maierl commented Jul 13, 2017

Just tried to send Ctrl+Z to a sleep 5 on bash. Worked just fine. Thanks for fixing!

@benhillis
Copy link
Member

Great, thank you both for confirming.

@kylemacfarlane
Copy link

Is there a reason why ctrl+z/c still don't work on ssh?

E.g. try doing ssh ip.you.know.wont.connect and there's no way to stop it until it times out.

@fpqc
Copy link

fpqc commented Jul 14, 2017

This is a different problem with its own issue.

@kylemacfarlane
Copy link

I found it #2220 but it's closed even though the fix is only on insider builds. Any idea when the fix will be released for production builds?

@sunilmut
Copy link
Member

@kylemacfarlane - The fix will be available in the Fall Creators Update public release.

@ivanlan9
Copy link

ivanlan9 commented Feb 2, 2018

The Fall Creators Update did not fix the problem. Ctrl-C still kills the bash console window, Ctrl-Z does nothing.

@bitcrazed
Copy link
Contributor Author

bitcrazed commented Feb 7, 2018

@ivanlan9:

I am able to CTRL+C to kill and CTRL+Z to stop an ssh connection awaiting a response from a non-existent server:
image

If you have other specific issues, could I ask you to please open a new issue & providing detailed repro steps, etc?

Many thanks.

@ivanlan9
Copy link

ivanlan9 commented Feb 7, 2018

I realized that the problem was probably not a bug in bash on Windows. Instead of running bash, I'm exec'ing mksh (wish there were a way to chsh). And that means that the original bash process is not an interactive one, thus it doesn't ignore SIGINT. Mksh is passing SIGINT on to the the bash process instead of ignoring it (this is probably either a bug in or an enhancement to mksh) when it's exec'ed.

I was able to work around the problem by inserting 'trap "echo" INT' into my mksh startup script.

Also, Ctrl-Z does the right thing: by "does nothing," I meant that it didn't close the terminal window the way Ctrl-C did. Ctrl-Z on a running process correctly backgrounds the process.

Many thanks for prodding me to think about the issue a bit more. ;-)

@therealkenc
Copy link
Collaborator

wish there were a way to chsh

chsh has worked since summer of 2017.

@ivanlan9
Copy link

ivanlan9 commented Feb 7, 2018

Doesn't appear to work. Chsh correctly changed /etc/passwd, but when I logged in, it gave me bash.

@benhillis
Copy link
Member

@ivanlan9 - Are you running bash.exe, wsl.exe, or the distru launcher binary (ubuntu.exe etc).

@ivanlan9
Copy link

ivanlan9 commented Feb 7, 2018

Oooh. "C:\Windows\System32\bash.exe ~"

This sounds promising! Please inform me!

@benhillis
Copy link
Member

benhillis commented Feb 7, 2018

"C:\Windows\System32\wsl.exe ~"

@ivanlan9
Copy link

ivanlan9 commented Feb 8, 2018

What can I say but "squee!" ;-)

Thanks!

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

No branches or pull requests