Re: [RFC] gdb/testsuite/gdb.base/fileio.exp patch for cygwin

Eli Zaretskii
2007-12-05T18:37:37Z

> Date: Wed, 5 Dec 2007 11:11:09 +0100
> From: Corinna Vinschen <vinschen@redhat.com>
>
> If you start a Cygwin process from another application using native
> Windows functions (CreateProcess, etc), the whole fork/exec magic is
> missing, apparently. One result is that the child process has to
> figure out what the stdin/out/err streams are, using native Windows
> functions. Since native Windows functions have no idea what a pseudo
> tty is, the information returned is that stdio streams are connected
> to pipes. So the child thinks its stdio streams are just pipes and
> pipes are not ttys, apparently.

I don't know if this is relevant (probably not), but please note that
native Windows implementation of `isatty' does not faithfully emulates
Posix functionality: it returns non-zero on _any_character_device_,
not just on a terminal. For example, try redirecting to/from the null
device.

My grabbag of workarounds for Windows gotcha's includes this:

#define ISATTY(fd) (isatty(fd) && lseek(fd,SEEK_CUR,0) == -1)