help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Coproc within coproc supported?


From: Tadeus Prastowo
Subject: Re: Coproc within coproc supported?
Date: Sat, 19 Nov 2022 00:21:39 +0100

Hi!

On Fri, Nov 18, 2022 at 5:31 PM Chet Ramey <chet.ramey@case.edu> wrote:
>
> On 11/18/22 5:33 AM, Tadeus Prastowo wrote:
>
> >> A (subshell) is an exact copy of the parent shell, so it inherits the
> >> coproc. It just won't be able to write or read to the coproc, and can't
> >> wait for a coproc it inherits, since the subshell is not the coproc
> >> process's parent.
> >
> > Given that coprocs are process-based and a subshell is a new process
> > despite being an exact copy of the parent process, I think logically
> > it follows that it is not a bug if the subshell creates a coproc.
> > Therefore, Bash back in the version 4.3.48 should have not issued the
> > coproc-exists warning.
>
> Sure, it was a spurious warning that didn't prevent the subshell from
> instantiating another coproc.

Thank you for your confirmation.

I have checked that Bash version 5.2.9(1)-release, which is the latest
I can download from https://savannah.gnu.org/projects/bash, no longer
issues the invalid warning for the following program:

coproc sleep 1
echo $$, $BASHPID, $COPROC_PID >&2
(coproc sleep 1; echo $$, $BASHPID, $COPROC_PID >&2; wait)
wait

But, it still correctly issues the expected warning in the following program:

coproc sleep 1
echo $$, $BASHPID, $COPROC_PID >&2
coproc sleep 1
echo $$, $BASHPID, $COPROC_PID >&2
wait

If it does not require you much effort, may I know around which
version of Bash after 4.3.48 the spurious warning issue was fixed?

Thank you very much for your kind help.

-- 
Best regards,
Eus



reply via email to

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