X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RFC_ABUSE_POST,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org MIME-Version: 1.0 In-Reply-To: <4DCAA510.9000909@sidefx.com> References: <20110510211800 DOT CCBDF9D5A21 AT mail2 DOT intersystems DOT com> <20110511063433 DOT GD28594 AT calimero DOT vinschen DOT de> <4DCAA510 DOT 9000909 AT sidefx DOT com> Date: Wed, 11 May 2011 16:59:39 +0100 Message-ID: Subject: Re: Who's using "CYGWIN=tty" and why? From: Andy Koppe To: cygwin AT cygwin DOT com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com On 11 May 2011 16:02, Edward Lam wrote: > On 5/11/2011 2:34 AM, Corinna Vinschen wrote: >> >> Kind of weird. =C2=A0The difference is that in tty mode the stdio handle= s are >> pipes, while in the notty case the stdio handles are console handles. >> Usually native Windows applications shouldn't see a difference and even >> work *better* in notty mode. > > One problem I ran into was with *Windows mode* applications (ie. MS link.= exe > option /SUBSYSTEM:windows) trying to detect stdout redirection. I apologi= ze > that this takes a bit of explaining first as to why we run into a problem > with Cygwin. > > For Windows-mode applications, _isatty(_fileno(stdout)) will always return > false. Due to a bug (in Windows and/or the CRT), the FILE *stdout object > will be initialized to a black hole. That's not a bug, at least not in either Windows or Cygwin. Linking with /SUBSYSTEM:windows tells Windows that the program doesn't need a console, so Windows does neither attach it to the console of its parent process nor create a new console for it. This mean that there's nowhere for the standard handles to point to. (With CYGWIN=3Dtty, the standard handles are connected to the pipes underlying Cygwin's pty implementation, which aren't affected by the /SUBSYSTEM:windows flag.) Andy -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple