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]

Cannot change console mode when set CYGWIN=tty


Hi all!

In order to fix a minor problem caused by ^C being intercepted by bash, I 
set CYGWIN=tty before launching bash.  This solves the problem of cmd 
asking the user to terminate the batch job.  This is great, however, it 
breaks some of my other existing code, specifically the ability to change 
the Console mode.  i.e.  with CYGWIN=tty:

   Error getting console mode (Error 6): The handle is invalid.
   exception....GetConsoleMode
   [436]:[darkfriend:/d/rfr/mtQACE]:

without CYGWIN=tty, all works fine.....

This is the code that I use:
     // Turn off the line input mode, and echo the input mode.
     if (! GetConsoleMode(hStdin, &fdwOldMode)) {
         printErr("Error getting console mode", GetLastError());
         throw runtime_error("GetConsoleMode");
         }
     fdwMode = fdwOldMode & ~(ENABLE_LINE_INPUT
                            | ENABLE_ECHO_INPUT
                            | ENABLE_PROCESSED_INPUT );
     if (! SetConsoleMode(hStdin, fdwMode)) {
         printErr("Error setting console mode", GetLastError());
         throw runtime_error("SetConsoleMode");
         }

Is there a work around for this?  If not, I will have to run without 
CYGWIN=tty until I get a chance to dig into the source and find out what 
CYGWIN=tty really does.
Cheers!
---------------------------
[436]:[darkfriend:~]: bash --version
GNU bash, version 2.05.0(6)-release (i686-pc-cygwin)
Copyright 2000 Free Software Foundation, Inc.
[437]:[darkfriend:~]:

     Cygwin DLL version info:
         dll major: 1003
         dll minor: 2
         dll epoch: 19
         dll bad signal mask: 19005
         dll old termios: 5
         dll malloc env: 28
         api major: 0
         api minor: 39
         shared data: 3
         dll identifier: cygwin1
         mount registry: 2
         cygnus registry name: Cygnus Solutions
         cygwin registry name: Cygwin
         program options name: Program Options
         cygwin mount registry name: mounts v2
         cygdrive flags: cygdrive flags
         cygdrive prefix: cygdrive prefix
         cygdrive default prefix:
         build date: Sun May 20 23:28:17 EDT 2001
         shared id: cygwin1S3

  - Mike


Mike Gingell, P.Eng.
Senior Systems Engineer, Maritime Systems
Computing Devices Canada


--
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]