Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #14053 > unrolled thread
| Started by | Geir Hauge <geir.hauge@gmail.com> |
|---|---|
| First post | 2018-04-24 22:46 +0200 |
| Last post | 2018-04-24 22:46 +0200 |
| Articles | 1 — 1 participant |
Back to article view | Back to gnu.bash.bug
Can't wait for process substitution redirected for a subshell Geir Hauge <geir.hauge@gmail.com> - 2018-04-24 22:46 +0200
| From | Geir Hauge <geir.hauge@gmail.com> |
|---|---|
| Date | 2018-04-24 22:46 +0200 |
| Subject | Can't wait for process substitution redirected for a subshell |
| Message-ID | <mailman.12955.1524602798.27995.bug-bash@gnu.org> |
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:
$ time bash -c '(echo "subshell \$! = $!"; wait "$!") 2> >(echo "procsub pid = $BASHPID"; sleep 2)'
subshell $! = 74756
procsub pid = 74756
2.014
I get the same behavior with both 4.4.19 and the latest devel snapshot
--
Geir Hauge
Back to top | Article view | gnu.bash.bug
csiph-web