This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Cannot change console mode when set CYGWIN=tty


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]