This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: - stdin read problem

Alexey Zakharov wrote on 25 April 2008 15:48:

> The program does the following:
> - The main thread creates a helper thread which reads stdin and prints
> the data read. 
> - stdin is read via ReadFile() Win32 API function.

  No, that's *not* stdin.  Stdin is file descriptor zero, and you aren't
reading from Cygwin's fd zero.  You just broke Cygwin's ptty implementation by
going behind its back and stealing its input.

  Just for comparison, this wouldn't work on Linux, would it?  Cygwin is a
Linux emulation layer.  Linux doesn't support calls to the Win32 api ReadFile,
obviously enough, so Cygwin doesn't either.

  In particular, it is not AFAIK a supported mode of operation to intersperse
Cygwin's emulated POSIX syscalls with arbitrary calls to the Win32 api that
Cygwin expects to have to itself in order to perform the emulation.

  You /may/ be able to get your code to work as you expect when launched from
a Cygwin shell running in a DOS prompt console by using the CYGWIN=notty
environment variable option (if you're currently using CYWIN=tty, that is),
but I don't think it'll ever work in a rxvt or X console.

Can't think of a witty .sigline today....

Unsubscribe info:
Problem reports:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]