www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2008/04/25/11:11:42

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
From: "Dave Korn" <dave DOT korn AT artimi DOT com>
To: <cygwin AT cygwin DOT com>
References: <216a31560804250748t30bd98cakde699a51cb40c407 AT mail DOT gmail DOT com>
Subject: RE: - stdin read problem
Date: Fri, 25 Apr 2008 16:11:08 +0100
Message-ID: <021d01c8a6e6$97d3ace0$2708a8c0@CAM.ARTIMI.COM>
MIME-Version: 1.0
X-Mailer: Microsoft Office Outlook 11
In-Reply-To: <216a31560804250748t30bd98cakde699a51cb40c407@mail.gmail.com>
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

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.

    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019