Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

enter key sometimes not recognized in windows apps under cygwin

Tags:

windows

cygwin

At work, I use Cygwin a lot because it offers me a small oasis in the vast desert of Windows. I inevitably end up running some non-Cygwin programs through the bash shell, such as build scripts (batch files created in-house) and the Subversion CLI binaries (I have the Windows ones installed). 99% of the time, I don't have any problems using this setup. The other 1%, however, causes a strange issue:

With both the build scripts and SVN, most of the time the enter key is interpreted correctly. For instance, I'll kick off the database creation script and it will prompt me for the server name. I type in "localhost" and hit enter. Everything's fine. Then it gets to the end, if there are errors, and prints things out using more. No key that I press is recognized by more. I have to Ctrl-C out of it.

Similarly, if I do a Subversion update, normally everything is fine. In the case where the interactive conflict resolution happens, however, I'll usually type in "tf" for "theirs-full" and hit enter, but nothing happens. I have to Ctrl-C out of it and re-run the update with force merge or use TortoiseSVN in Windows to do it.

Any idea why Cygwin seems to randomly not be passing the enter key through to the programs? I considered that it may have something to do with Unix vs Windows style line endings, so I've tried typing those characters manually, but that doesn't seem to make a difference. Thanks.

Edit: I just had this happen to me again and I realized something. It was SVN prompting me for a password. I typed in the password, which it echoed to the screen (bad) and hit enter... nothing. Hit enter a few more times, the cursor moves, but nothing happens. I hit Ctrl-C and it dumps me back to bash, which then says "bash: [my password]: command not found" followed by a number of new prompts equal to the number of times I hit the enter key. So what happened is the input never made it to SVN, but somehow got read by bash after SVN exited. I thought that may help someone figure out what is going on.

like image 996
rmeador Avatar asked Oct 14 '08 19:10

rmeador


People also ask

Is Cygwin still supported?

As of the creation of this article: Red Hat Cygwin is supported on all 32- and 64-bit versions of Windows since 2003 Server. Cygwin is available as both a 32- and 64-bit platform supporting 32 on 32-bit, 32 on 64-bit, and 64 on 64-bit installations.

How do I login as root in Cygwin?

Enter . \root as the username and then your password.


2 Answers

Unfortunately, I think you are hitting one of the issues of Cygwin and windows/dos console apps. See "Console Programs" at http://www.cygwin.com/cygwin-ug-net/using-effectively.html.

It is just a limitation on windows console apps. This behavior is common for the windows myqsl cmd client and svn client, for example.

Here are some things to note -- I've successfully used this approach with both the Windows mysql as well as Windows svn clients:

1) Try making sure you do NOT have "tty" in your CYGWIN environment variable and see if that helps (unset it in My Computer->properties->advanced->Environment Variables and close/restart any cygwin bash prompts).

2) Do not use RXVT -- instead, use the basic Cygwin cmd prompt. This is because RXVT implies "tty" and will break #1 above.

3) Try finding a "native" Cygwin package for the cmds you are having issues with instead of using the Windows cmds. (I haven't found a 1.6 svn client for cygwin yet, though.)

Good luck! Dustin

like image 66
DustinB Avatar answered Nov 04 '22 12:11

DustinB


The lengthy discussion on the mintty project is here - http://code.google.com/p/mintty/issues/detail?id=56

One solution mentioned which worked in my case (entering authentication passwords for native subversion) is conin - http://code.google.com/p/mintty/downloads/detail?name=conin-0.0.2.zip&can=1&q=label%3ADevelopment

$ conin svn list https://{repo}
Password for 'user': ******
like image 32
Vic Avatar answered Nov 04 '22 10:11

Vic