delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/05/29/23:42:10

X-Spam-Check-By: sourceware.org
Message-ID: <465CF292.7020309@byu.net>
Date: Tue, 29 May 2007 21:42:10 -0600
From: Eric Blake <ebb9 AT byu DOT net>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.10) Gecko/20070221 Thunderbird/1.5.0.10 Mnenhy/0.7.5.666
MIME-Version: 1.0
To: cygwin AT cygwin DOT com, binkley AT alumni DOT rice DOT edu
Subject: Re: more on Re: bash process substitution "<(list)" [spot the difference]
References: <465CE9DE DOT 4030907 AT alumni DOT rice DOT edu>
In-Reply-To: <465CE9DE.4030907@alumni.rice.edu>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.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

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to B. K. Oxley (binkley) on 5/29/2007 9:05 PM:
> Why does one of these scripts produce an error and the other does not?
> function f()
> {
>    echo "$1"

shell builtin, and it does not touch the fifo (try replacing this with
/bin/echo to see the difference)

>    cat "$1"

so the fifo is still available

> function f()
> {
>    ls -l "$1"

external process, which calls exit() and thus closes the only read handle
on the fifo.  At which point, the writer is closed since no reader exists.

>    cat "$1"

the fifo no longer exists, so the error is correct

If you need the fifo to persist over several external commands, you need
to use a shell grouping construct or an exec so that the shell holds a
handle to the fifo for the duration of the shell function.  And this is
not cygwin specific.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             ebb9 AT byu DOT net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGXPKR84KuGfSFAYARAlZuAKDVNUr7vzs2lRFjcaS0201C+uu7IgCfUK81
vVzTHO2X4g0SKg2CBK126hk=
=UL94
-----END PGP SIGNATURE-----

--
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