Mailing-List: contact cygwin-help@sourceware.cygnus.com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@sources.redhat.com Delivered-To: mailing list cygwin@sources.redhat.com Date: Fri, 27 Jul 2001 17:36:44 +0400 From: egor duda X-Mailer: The Bat! (v1.53 RC/4) Reply-To: egor duda Organization: deo X-Priority: 3 (Normal) Message-ID: <179281668087.20010727173644@logos-m.ru> To: Mike Gingell CC: cygwin@cygwin.com Subject: Re: Cannot change console mode when set CYGWIN=tty In-Reply-To: <5.1.0.14.0.20010727092409.00aeefc0@mail.accesswave.ca> References: <5.1.0.14.0.20010727092409.00aeefc0@mail.accesswave.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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/