delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/01/12/17:21:59

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/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
Message-Id: <5.2.0.9.2.20030112141731.01df7bc8@pop3.cris.com>
X-Sender: rrschulz AT pop3 DOT cris DOT com
Date: Sun, 12 Jan 2003 14:21:45 -0800
To: "Rolf Campbell" <rcampbell AT tropicnetworks DOT com>, <cygwin AT cygwin DOT com>
From: Randall R Schulz <rrschulz AT cris DOT com>
Subject: Re: Return codes and pipelines
In-Reply-To: <83040F98B407E6428FEC18AC720F5D73015BA93F@exchange.tropicne
tworks.com>
Mime-Version: 1.0

Rolf,

One posting is enough, really.

There is no guaranteed or specified parent child relationship between the 
processes in a pipeline. This means that you cannot predict which process's 
status will be the one returned as that of the pipeline as a whole.

You can force this in your contrived example by adding an exit call.

All of these will print "true:"

(true | true; exit 0) && echo true || echo false
(false | true; exit 0) && echo true || echo false
(true | false; exit 0) && echo true || echo false
(false | false; exit 0) && echo true || echo false


Randall Schulz


At 14:09 2003-01-12, Rolf Campbell wrote:
>/home/rcampbell> (true | true) && echo true || echo false
>true
>/home/rcampbell> (true | false) && echo true || echo false
>false
>/home/rcampbell> (false | true) && echo true || echo false
>true
>/home/rcampbell> (false | false) && echo true || echo false
>false
>
>The third test above yields different results when run on Linux.  I'm
>wondering if this was the desired result or not?  (This is not a new
>problem, it's been around for at least a year of releases).  It makes
>some makefiles not work as expected, specifically, the GCC manual
>describes how to perform auto-dependency analysis like:
>
>gcc ... | sed ...
>
>But, if gcc fails, sed will still work, thus make will not consider it a
>failure and will continue.
>
>I know there are many ways to avoid this specific problem, already
>implemented one.  Just wanted to let you guys know.
>
>
>-Rolf Campbell


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.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