bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: some problems with scope of fds in process substitution


From: Chet Ramey
Subject: Re: some problems with scope of fds in process substitution
Date: Mon, 4 Dec 2017 08:46:24 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.5.0

On 12/3/17 6:07 PM, Stephane Chazelas wrote:
> 2017-12-03 17:31:00 -0500, Chet Ramey:
>> On 12/1/17 2:00 PM, Stephane Chazelas wrote:
>>
>>> Also, there's a lot of problems reported at
>>> unix.stackexchange.com at least that are caused by bash not
>>> waiting for the processes started by process substitutions,
>>> especially the >(...) form.
>>
>> Bash always reaps these processes. Do you mean waiting for them
>> to terminate before executing the next command?
> [...]
> 
> Hi Chet,
> 
> yes, that's what I meant as in:
> 
> $ rm -f a; bash -c 'echo test > >(cat > a); cat a'
> $

Bash-4.4 allows you to wait for the last process substitution, since the
pid appears in $!, like ksh93. There's still no option to wait for more
than one, though I imagine I could make that work as part of `wait'
without arguments.

$ cat ~/x20a
rm -f a;
echo test > >(cat > a)
echo waiting for $!
wait $!
echo $?
cat a
$ ../bash-4.4-patched.rhe6/bash ~/x20a
waiting for 2762
0
test
$ ../bash-4.4-patched.rhe6/bash --version
GNU bash, version 4.4.12(2)-release (x86_64-unknown-linux-gnu)
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]