bug-bash
[Top][All Lists]
Advanced

[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: Sat, 12 Oct 2024 10:09:09 -0400

On Sun, Jul 14, 2024 at 8:40 PM Zachary Santer <zsanter@gmail.com> wrote:
>
> On Tue, Jul 9, 2024 at 2:37 PM Zachary Santer <zsanter@gmail.com> wrote:
> >
> > On the other hand, do funsubs give us the answer here?
> >
> > shopt -s lastpipe
> > declare -a pid=()
> > command-1 | tee >( command-2 ) ${ pid+=( "${!}" ); } >( command-3 ) ${
> > pid+=( "${!}" ); } >( command-4 ) ${ pid+=( "${!}" ); }
> > wait -- "${pid[@]}"
>
> This absolutely works, so there you go. When expanding multiple
> process substitutions as arguments to a command, you can save the $!
> resulting from each one by following it with an unquoted funsub that
> does that work and doesn't expand to anything.
>
> > That looks obnoxious
>
> I don't mind how it looks. It works.
>
> > declare -a pid=()
> > {
> >   commands
> > } {fd[0]}< <( command-1 )  ${ pid+=( "${!}" ); } {fd[1]}< <( command-2
> > ) ${ pid+=( "${!}" ); } {fd[2]}< <( command-3 ) ${ pid+=( "${!}" ); }
> >
> > Do things start breaking?
>
> Yeah, this doesn't work at all

Even that can be made to work by simply removing the space between the
process substitution and the following function substitution. Bash
treats the whole amalgamation as one word. See attached. That was run
by the current devel branch commit: c7439376a3.

Just noticed that, in the second set of procsubs, it looks like bash
is skipping over a potential pid from procsub to procsub. Not sure
what to make of that.

On Wed, Aug 7, 2024 at 12:03 PM Zachary Santer <zsanter@gmail.com> wrote:
>
> What's the purpose of 'wait' without id arguments
> being restricted to the final procsub, then? It sounds like the
> various issues revealed by Oğuz's October 2022 bug report were
> resolved by making other changes.

Backwards compatibility with people's expectations from earlier releases?

At least this is all documented.

Attachment: procsub-wait-solution-output.txt
Description: Text document

Attachment: procsub-wait-solution
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]