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


Groups > gnu.bash.bug > #14054 > unrolled thread

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

Started byChet Ramey <chet.ramey@case.edu>
First post2018-04-25 09:04 -0400
Last post2018-04-25 09:04 -0400
Articles 1 — 1 participant

Back to article view | Back to gnu.bash.bug

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

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

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

FromChet Ramey <chet.ramey@case.edu>
Date2018-04-25 09:04 -0400
SubjectRe: Can't wait for process substitution redirected for a subshell
Message-ID<mailman.12966.1524661481.27995.bug-bash@gnu.org>
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/

[toc] | [standalone]


Back to top | Article view | gnu.bash.bug


csiph-web