[Top][All Lists]

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

Re: wait inside subshell waits for sibling

From: Chet Ramey
Subject: Re: wait inside subshell waits for sibling
Date: Thu, 27 Oct 2022 16:11:35 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.4.0

On 10/24/22 4:52 AM, Emanuele Torre wrote:
On 24/10/2022, Robert Elz <kre@munnari.oz.au> wrote:

There's no reason that wait (the command) cannot check for candidate
jobs which are still running, and wait for any of those, and then
return as soon as there are none left.   That the shell happens to
have forked other processes for its own reasons should make no
difference at all.

Process substitutions are considered background jobs, and the wait
builtin waits for them.

They're not jobs: they don't go in the jobs list, `jobs' doesn't report
on them, and fg/bg don't affect them. They're asynchronous processes
that happen to set $! (which may have been a mistake, but too late now).

`wait' can wait for them because they set $!, but as documented `wait'
without arguments only waits for the last one, and only if its pid is
the same as $!.

In POSIX terms, they are "known to the current shell execution

``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/

reply via email to

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