Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #14054

Re: Can't wait for process substitution redirected for a subshell

From Chet Ramey <chet.ramey@case.edu>
Newsgroups gnu.bash.bug
Subject Re: Can't wait for process substitution redirected for a subshell
Date 2018-04-25 09:04 -0400
Message-ID <mailman.12966.1524661481.27995.bug-bash@gnu.org> (permalink)
References <20180424204626.gvwpp2funm6rlntt@MacGeir2>

Show all headers | View raw


On 4/24/18 4:46 PM, Geir Hauge wrote:
> Waiting on a process substitution that is used in redirection for a
> command grouping works, but not when using a subshell in place of that
> command grouping:
> 
>     $ TIMEFORMAT=%R
>     $ time bash -c '{ :; } 2> >(sleep 2); wait "$!"'
>     2.013
>     $ time bash -c '(:) 2> >(sleep 2); wait "$!"'
>     bash: line 0: wait: `': not a pid or valid job spec
>     0.008
> 
> I'd expect those two cases to behave the same way.
> 
> It looks like the redirection is done after the subshell is forked, so
> adding the wait inside the subshell actually works:

Yes, expansion and redirections are performed in a subshell when the shell
executes a subshell command. Bash has always behaved like this, and I don't
foresee changing it.

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

Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread


Thread

Re: Can't wait for process substitution redirected for a subshell Chet Ramey <chet.ramey@case.edu> - 2018-04-25 09:04 -0400

csiph-web