is-cygwin-tty check

Mihail Konev
Sat Nov 12 02:21:00 GMT 2016

A function for mingw-w64 is being proposed,
that would distinguish between an ordinary named pipe,
and a mintty-like stdin.

(Needed for mingw-w64 packages that rely on isatty()/fstat(stdin)
to work correctly if they are launched not from cmd.exe console).

Currently, it checks the ObjectNameInformation for
- possible "\\?\" in front of string
- "\Device\NamedPipe\"
- any characters afterwards
- "-pty[0-9]+-"
- allowing anything afterwards

Is the check correct?

In particular, should it put any restrictions
on what is before and after the -pty%d- (slashes, non-[-a-z0-9] ?)
-------------- next part --------------
An embedded message was scrubbed...
From: Mihail Konev <>
Subject: [Mingw-w64-public] [PATCH v4] Add include/iscygtty.c
Date: Sat, 12 Nov 2016 06:58:32 +0500
Size: 7685
URL: <>

More information about the Cygwin-developers mailing list