X-Recipient: archive-cygwin@delorie.com
X-SWARE-Spam-Status: No, hits=-1.8 required=5.0	tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE
X-Spam-Check-By: sourceware.org
X-Mail-Handler: MailHop Outbound by DynDNS
X-Report-Abuse-To: abuse@dyndns.com (see http://www.dyndns.com/services/mailhop/outbound_abuse.html for abuse reporting information)
X-MHO-User: U2FsdGVkX184W80n9DpxSinhmzSjWUcD
Date: Mon, 12 Mar 2012 18:02:04 -0400
From: Christopher Faylor <cgf-use-the-mailinglist-please@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: Can't reliably redirect standard output from C# program in recent Cygwin
Message-ID: <20120312220204.GA29921@ednor.casa.cgf.cx>
Reply-To: cygwin@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
References: <004e01ccfd70$c69af3f0$53d0dbd0$@motionview3d.com> <005c01ccfd79$6341f980$29c5ec80$@motionview3d.com> <loom.20120309T021648-138@post.gmane.org> <007201ccfe25$130065e0$390131a0$@motionview3d.com> <20120309195247.GB18960@calimero.vinschen.de> <20120311013339.GA32518@ednor.casa.cgf.cx> <00b701cd0059$25c26a80$71473f80$@motionview3d.com> <20120312141929.GE2382@calimero.vinschen.de> <00cf01cd0075$8430b290$8c9217b0$@motionview3d.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <00cf01cd0075$8430b290$8c9217b0$@motionview3d.com>
User-Agent: Mutt/1.5.20 (2009-06-14)
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
Precedence: bulk
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie.com@cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

On Mon, Mar 12, 2012 at 05:28:17PM -0000, James Johnston wrote:
>Well, good call.  I shouldn't have jumped to conclusions.  Both my C++
>and C# examples still fail:

Not really a call.  It was obviously different failure.  The previous
fix wasn't even pipe related.

But, regardless, Corinna (who has more time these days to look into
this type of thing) found a damning piece of MSDN documentation which
indicates that a write of zero bytes to a pipe will cause a read of
zero bytes on the other end of the pipe.  So, a program which assumes
that a zero byte read means EOF, like most Linux programs, will stop
processing when it sees the zero bytes from ReadFile.

Corinna sent me a patch to fix the problem which I've mildly tweaked and
installed.  It's in the latest snapshot.

cgf

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

