[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: waiting for process substitutions
From: |
Zachary Santer |
Subject: |
Re: waiting for process substitutions |
Date: |
Tue, 2 Jul 2024 21:59:50 -0400 |
On Tue, Jul 2, 2024 at 4:56 PM Mark March <m_a_r_c_h@yahoo.com> wrote:
>
> lastpipe takes effect only if job control is off. From the man page:
>
> lastpipe
> If set, and job control is not active, the shell....
>
> With laspipe on and job control off, 'wait' appears to wait for all process
> substitutions:
>
> set +m
> shopt -s lastpipe
> echo $'foo\nbar' | tee >(echo first ; exit 1) >(wc ; sleep 10 ; echo wc)
> >(tail -n 1; echo tail)
> wait
>
> blocks for 10s under Bash 5.2.21.
>
> Likely just a documentation bug.
I didn't have lastpipe enabled in my initial repeat-by script. Now
that this one has that as an option, I'm not seeing a difference in
behavior between having it enabled or not.
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. I'm going to go with the change
in behavior here being unintended, actually. Besides having different
set and shopt options on or off by default, running things in the
interactive shell versus in a script doesn't tend to differ much.
Could be an interaction with some other set or shopt option whose
setting differs between a script and the interactive shell, I guess.
procsub-wait
Description: Binary data
- Re: waiting for process substitutions, Mark March, 2024/07/02
- Re: waiting for process substitutions,
Zachary Santer <=
- Re: waiting for process substitutions, Chet Ramey, 2024/07/03
- Re: waiting for process substitutions, Martin D Kealey, 2024/07/03
- Re: waiting for process substitutions, Zachary Santer, 2024/07/03
- Re: waiting for process substitutions, Chet Ramey, 2024/07/05
- Re: waiting for process substitutions, Greg Wooledge, 2024/07/05
- Re: waiting for process substitutions, Dale R. Worley, 2024/07/08
- Re: waiting for process substitutions, Chet Ramey, 2024/07/08
- Re: waiting for process substitutions, alex xmb sw ratchev, 2024/07/08