On 11 May 2011 16:02, Edward Lam wrote: > On 5/11/2011 2:34 AM, Corinna Vinschen wrote: >> >> Kind of weird. The difference is that in tty mode the stdio handles 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 apologize > 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=tty, 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