Machine Type: i586-pc-linux-gnu
Bash Version: 4.3
Patch Level: 33
Release Status: release
Description:
As stated in the man page, bash will only allow a single coproc at a time.
Thus, when a first coproc has already ended, a second one can be created.
This can e.g. be verified by commenting out the upper #sleep line, below.
Alternatively, you can remove the parens that start the subshell.
But if we start a subshell while the coproc still runs, then wait inside
the subshell
until the first coproc has ended and then try to start another coproc,
bash prints the
infamous warning:
./test_sp1.sh: line 10: warning: execute_coproc: coproc [11030:COPROC]
still exists
The process id 11030 does (verifyably - e.g. add `ps a`) not exist the
time the warning is printed.░
Repeat-By:
coproc { echo "Start 1" >&2; sleep 1; echo "Stop 1" >&2; }
#sleep 1.1 # use this instead and the warning will disapped
sleep 0.9
(
sleep 0.5
coproc { echo "Start 2" >&2; sleep 1; echo "Stop 2" >&2; }
)
sleep 1.5
echo "Done"
Fix:
Probably some internal variables have to be reset on fork().
[Prev in Thread]
Current Thread
[Next in Thread]
coproc state wrongly inherited by subshell,
Tobias Hoffmann<=