Why can I only suspend using Ctrl-Z in screen under Cygwin?

5

I'm using Cygwin with ConEmu in Windows 7. I can't suspend programs in bash using CtrlZ unless I'm using GNU/Screen.

I've seen suggestions to use mintty, and that works, but I'm not sure why it makes a difference. Is there a way to get CtrlZ to work while using ConEmu?

Morgan May

Posted 2013-04-10T10:25:11.190

Reputation: 421

What do you want to do with Ctrl+Z? – Maximus – 2013-04-10T11:02:30.920

I want to suspend Unix programs running in Cygwin (I know it won't work with Windows programs). – Morgan May – 2013-04-11T21:17:39.857

Answers

2

I have a similar setup -- Cygwin bash + screen in ConEmu. Ctrl-Z works in both bash and in screen itself. Perhaps you need to upgrade to the latest Cygwin version or maybe you have already gotten past this problem.

I did notice what you were talking about, though, specifically when testing with /bin/sleep.exe. I can't suspend that with Ctrl-Z in bash, but I can inside of screen. Further, I can suspend it in bash by using kill -17 [pid of running sleep.exe] from another screen window (Ctrl-Z sends a SIGSTOP, which kill -l shows as #17). So, ya got me... something about Cygwin's sleep.exe is funky.

Sorry to reply to an old thread on here, but I was searching for answers on a similar topic -- that of suspended processes in ConEmu in general. I'll post in another thread on that subject.

cptstubing06

Posted 2013-04-10T10:25:11.190

Reputation: 21

0

ConEmu does not process Ctrl+Z keycombo at all. It is your console application (shell) responsibility.

But you may "pause" console output switching Conemu to alternative buffer, Win+A keycombo by default.

Maximus

Posted 2013-04-10T10:25:11.190

Reputation: 19 395

That’s not surprising, since ConEmu is a Windows console emulator, and (Ctrl+Z) –– and process suspension, for that matter –– are alien to Windows. – Scott – 2013-04-10T23:16:31.407

@Scott don't know how exactly "suspension" works in *nix platforms, but ConEmu can pause console output. – Maximus – 2013-04-11T09:46:05.397

Pausing the output with Win+A doesn't seem to let me issue new commands, which is part of what I want to do. I want Unix-style job control (which already works partially - Ctrl-C works as expected). – Morgan May – 2013-04-11T21:21:32.697

Here's where I'm confused: with bash running on Linux, Ctrl-Z works fine. On Windows (using Cygwin), it seems to vary based on console - it works in mintty, but not in ConEmu (or a few others I've tried, like Console2). But (and here's the really confusing part) if I run screen within bash, it seems to work regardless of which console I'm using. So if it always works in screen, why doesn't it always work in bash? – Morgan May – 2013-04-11T21:25:58.637

Why? Obviously, screen supports Ctrl+Z, bash do not supports Ctrl+Z. You may fill new issue on ConEmu project website with feature request (thorough description is required). – Maximus – 2013-04-11T21:29:36.057

Except Ctrl-Z works with bash under mintty. – Morgan May – 2013-04-16T02:38:23.107

Still don't know exactly what Ctrl+Z doing, but suppose that mintty process this hotkey internally. – Maximus – 2013-04-16T21:01:17.033

Cygwin emulates a Unix-style command line for Windows (specifically, the Bash shell). There are various shortcuts that can be used to control running processes. Ctrl-C kills the current process, Ctrl-Z allows you to pause a running process so that you can enter new commands, etc. With Cygwin, some of these shortcuts work no matter which console I'm using (like Ctrl-C), but others only work while using certain consoles. Ctrl-Z works while running Cygwin in mintty, but not in ConEmu or Console2. However, if I use the "screen" program within Cygwin, Ctrl-Z works no matter which console I use. – Morgan May – 2013-04-29T05:15:14.277