On 7/2/24 9:59 PM, Zachary Santer 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.
There are no process substitutions or asynchronous processes for `wait' to return, since the last pipeline element containing the procsubs is executed in a child process.
With lastpipe enabled, it does seem to wait for everything.
The last pipeline element is executed in the current environment, and any side effects persist in the current environment, so you have process substitutions for `wait' to return. I didn't look at the script behavior, since you don't have any pipelines where lastpipe might have an effect. -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, UTech, CWRU c...@case.edu http://tiswww.cwru.edu/~chet/
OpenPGP_signature.asc
Description: OpenPGP digital signature