On Wed, 27 Oct 2004 09:51:43 -0400 (EDT), "Earnie Boyd"
<earnie@...> wrote :
>Posted on DATE by AUTHOR Duncan Murdoch
>> [This may be a duplicate post, but I didn't see the original show up.
>> If so, sorry!]
>>
>> Not sure if this is a MinGW bug, a Cygwin bug, or just the way things
>> are, but anyway:
>>
>
>I've read all of the posts on this subject to date but responding to the
>original anyway.
>
>This issue belongs to Cygiwn if you're using Cygwin distributed shells.
>It is not a bug with isatty(). Read-on.
Yes, Benny Riefenstahl has convinced me of that.
>> I use a Cygwin bash shell. Normally I start the shell with the CYGWIN
>> variable set using "CYGWIN=binmode tty ntsec". I noticed recently
>> that one of my programs thinks it's running in batch mode rather than
>> interactively, and tracked it down to isatty(0) returning false. If I
>> leave out the "tty" from the CYGWIN variable, then isatty(0) returns
>> true.
>>
>
>You don't say if you're using RXVT or not. Rxvt is known to return isatty
>of false.
I don't know what Rxvt is, and don't seem to have a man page for it,
so I guess not.
>> I don't really know what "tty" does. The docs say
>>
>>> * `(no)tty' - if set, Cygwin enables extra support (i.e., termios)
>>> for UNIX-like ttys. It is not compatible with some Windows
>>> programs. Defaults to not set, in which case the tty is opened in
>>> text mode. Note that this has been changed such that ^D works as
>>> expected instead of ^Z, and is settable via `stty'. This option
>>> must be specified before starting a Cygwin shell and it cannot be
>>> changed in the shell.
>>
>> This doesn't mean a lot to me. Do I want termios? Should isatty() be
>> returning true if I set this? Is there a better test of running
>> interactively?
>>
>
>Good question, I don't have a good example off the top of my head, perhaps
>you could use some of the Windows API methods to return the console handle
>and if it return an invalid handle determine that there is no console.
What I'm trying to distinguish is between
echo junk | rterm
and
rterm
where rterm is a console-mode program, which should operate
interactively in the latter case. I suspect there will be a console
handle in both cases (but I haven't checked yet).
Duncan Murdoch
|