On Tue, Jul 2, 2024 at 9:59 PM Zachary Santer <zsan...@gmail.com> wrote: > > I *am* seeing a difference between having lastpipe enabled (and job > control off) or not when running your example in the interactive > shell, though: > SECONDS=0; echo $'foo\nbar' | tee >(echo first ; exit 1) >(wc ; sleep > 10 ; echo wc) >(tail -n 1; echo tail); wait; printf '%s\n' > "SECONDS=${SECONDS}" > > With lastpipe disabled, wait exits immediately. With lastpipe enabled, > it does seem to wait for everything.
Though this would be because, without lastpipe enabled, the child processes for the process substitutions are being forked in what is already a subshell environment, so no record of them would exist in the parent shell where wait is being called. Nevermind. Compare this: SECONDS=0; echo $'foo\nbar' | { tee >(echo first ; exit 1) >(wc ; sleep 10 ; echo wc) >(tail -n 1; echo tail); wait; printf '%s\n' "SECONDS=${SECONDS}"; } In this example, the call to wait occurs in the same shell environment that the process substitutions were forked in, whether lastpipe is enabled or not. Now the behavior is the same either way.