bug-bash
[Top][All Lists]
Advanced

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

Re: 'wait -n' with and without id arguments


From: Chet Ramey
Subject: Re: 'wait -n' with and without id arguments
Date: Wed, 7 Aug 2024 11:06:25 -0400
User-agent: Mozilla Thunderbird

On 7/31/24 11:40 AM, Zachary Santer wrote:
On Fri, Jul 26, 2024 at 10:37 AM Chet Ramey <chet.ramey@case.edu> wrote:

On 7/20/24 1:50 PM, Zachary Santer wrote:

'wait' without -n or pid arguments doesn't look in the list of saved
pids and statuses simply because it would serve no purpose for it to
do so. The return status will be 0, no matter how any child process
terminated, or even if there never was a child process. *

For 'wait -n', on the other hand:
"If the -n option is supplied, wait waits for a single job from the
list of ids or, if no ids are supplied, any job, to complete and
returns its exit status."
People are going to naturally expect 'wait -n' without pid arguments
to return immediately with the exit status of an already-terminated
child process, even if they don't provide id arguments. In order to do
so, 'wait -n' obviously has to look in the list of saved pids and
statuses.

I think the part you're missing is that processes get moved to this list
after the user has already been notified of their termination status.

I think I was missing more than that. Was the original 'wait -n'
discussion from January specific to its use within the interactive
shell?

No, it was due to processes exiting due to signals. But you could have
looked that up yourself.

--
``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/

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature


reply via email to

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