This is the mail archive of the
cygwin@cygwin.com
mailing list for the Cygwin project.
Re: Cannot change console mode when set CYGWIN=tty
- To: Mike Gingell <mgingell at accesswave dot ca>
- Subject: Re: Cannot change console mode when set CYGWIN=tty
- From: egor duda <deo at logos-m dot ru>
- Date: Fri, 27 Jul 2001 17:36:44 +0400
- CC: cygwin at cygwin dot com
- Organization: deo
- References: <5.1.0.14.0.20010727092409.00aeefc0@mail.accesswave.ca>
- Reply-To: egor duda <cygwin at cygwin dot com>
Hi!
Friday, 27 July, 2001 Mike Gingell mgingell@accesswave.ca wrote:
MG> In order to fix a minor problem caused by ^C being intercepted by bash, I
MG> set CYGWIN=tty before launching bash. This solves the problem of cmd
MG> asking the user to terminate the batch job. This is great, however, it
MG> breaks some of my other existing code, specifically the ability to change
MG> the Console mode. i.e. with CYGWIN=tty:
MG> Error getting console mode (Error 6): The handle is invalid.
MG> exception....GetConsoleMode
MG> [436]:[darkfriend:/d/rfr/mtQACE]:
MG> without CYGWIN=tty, all works fine.....
MG> This is the code that I use:
MG> // Turn off the line input mode, and echo the input mode.
MG> if (! GetConsoleMode(hStdin, &fdwOldMode)) {
MG> printErr("Error getting console mode", GetLastError());
MG> throw runtime_error("GetConsoleMode");
MG> }
MG> fdwMode = fdwOldMode & ~(ENABLE_LINE_INPUT
MG> | ENABLE_ECHO_INPUT
MG> | ENABLE_PROCESSED_INPUT );
MG> if (! SetConsoleMode(hStdin, fdwMode)) {
MG> printErr("Error setting console mode", GetLastError());
MG> throw runtime_error("SetConsoleMode");
MG> }
MG> Is there a work around for this? If not, I will have to run without
MG> CYGWIN=tty until I get a chance to dig into the source and find out what
MG> CYGWIN=tty really does.
MG> Cheers!
it enables emulation of unix-like ttys. so, when your program runs in
such "tty" environment, its hStdin is a pipe to tty master. use unix
api to control tty mode instead of windows. see tcsetattr() function
for details.
Egor. mailto:deo@logos-m.ru ICQ 5165414 FidoNet 2:5020/496.19
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/