From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3401 invoked by alias); 11 May 2011 16:00:00 -0000 Received: (qmail 3391 invoked by uid 22791); 11 May 2011 15:59:59 -0000 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 Received: from mail-qy0-f178.google.com (HELO mail-qy0-f178.google.com) (209.85.216.178) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 11 May 2011 15:59:40 +0000 Received: by qyk2 with SMTP id 2so461755qyk.2 for ; Wed, 11 May 2011 08:59:40 -0700 (PDT) MIME-Version: 1.0 Received: by 10.229.5.209 with SMTP id 17mr7182991qcw.85.1305129580087; Wed, 11 May 2011 08:59:40 -0700 (PDT) Received: by 10.229.34.81 with HTTP; Wed, 11 May 2011 08:59:39 -0700 (PDT) In-Reply-To: <4DCAA510.9000909@sidefx.com> References: <20110510211800.CCBDF9D5A21@mail2.intersystems.com> <20110511063433.GD28594@calimero.vinschen.de> <4DCAA510.9000909@sidefx.com> Date: Wed, 11 May 2011 16:00:00 -0000 Message-ID: Subject: Re: Who's using "CYGWIN=tty" and why? From: Andy Koppe To: cygwin@cygwin.com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com X-SW-Source: 2011-05/txt/msg00163.txt.bz2 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