Cygwin terminals don't run some native Windows programs

3

For compatibility with other Windows programs, I have to install the Windows version of Mercurial (vs. the Cygwin version), for Python, etc.

Unfortunately, these native Windows programs seem to have problems with interactive input in Cygwin shells. Furthermore, some native programs don't even run (msysgit makes me type "git.cmd" every time instead of "git").

I don't want to have to switch between two terminals all the time. What is the best workaround or compromise to this problem?

I've tried setting CYGWIN=notty as an environment variable but that doesn't seem to help either.

Thanks.

Jonathan Chan

Posted 2011-12-06T10:28:00.940

Reputation: 99

Answers

5

You'll need to use a Cygwin console (based on the standard Windows console) instead of the default Cygwin terminal.

One way to do that is to create a shortcut that directly invokes bash as a login shell, in which case Windows automatically creates a console window for it. Here's a command to create such a shortcut on the desktop:

mkshortcut -D -n "Cygwin Console" -i /Cygwin.ico /bin/bash -a --login

ak2

Posted 2011-12-06T10:28:00.940

Reputation: 3 387

Where do I type this command? – LazerSharks – 2015-05-06T04:45:30.180

That's the same shell I've been using that's having problems with some Windows applications, though. :( – Jonathan Chan – 2011-12-07T00:26:00.397

1You need to distinguish between the terminal/console, which is the thing displaying a text window, and the shell, which is the thing running inside that window and interpreting commands. Anyway, if you're already using the console, I'm a bit stumped. Are you running screen inside it? Is CYGWIN set to tty before the initial Cygwin process is started? Setting it to notty inside a Cygwin session won't make a difference. – ak2 – 2011-12-07T08:28:44.777

Sorry about that ambiguity, I meant terminal. No, I'm not running screen inside of it. I set CYGWIN to tty outside of the Cygwin session, of course. – Jonathan Chan – 2011-12-09T23:26:13.513

3Then that's the problem. Setting CYGWIN to tty enables Cygwin's "pseudo terminal device" layer in the console, which gives you more Unix-compatible terminal funcionality (e.g. the ability to suspend processes with ^Z). However, this is based on Windows pipes, and means that native Windows programs get a pipe handle where they expect a console handle, and interactive programs often don't function as expected with those. – ak2 – 2011-12-10T10:12:30.367

"native Windows programs get a pipe handle where they expect a console handle, and interactive programs often don't function as expected with those." I think that that was the original problem. :P Thanks anyways! – Jonathan Chan – 2011-12-10T21:58:09.830

Thank goodness for this question/answer. I installed a new system, installed the latest cygwin and git, and suddenly git was broken for me. Why on earth did cygwin remove the shortcut for the old console window. – JimN – 2012-03-29T03:48:39.860

@JimN Note that Cygwin has its own git package, which does work fine in the default terminal. Also, unlike msysgit, it has full Unicode support. – ak2 – 2012-03-29T05:22:50.067

ak2, well for me cygwin's git has never worked. It's always broken in some way or another. – JimN – 2012-06-08T02:16:16.190