[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Wanted: bash enhancement... non-blocking 'wait'
From: |
Dennis Williamson |
Subject: |
Re: Wanted: bash enhancement... non-blocking 'wait' |
Date: |
Fri, 3 Sep 2010 15:20:35 -0500 |
On Fri, Sep 3, 2010 at 3:12 PM, Philip Prindeville
<philipp@redfish-solutions.com> wrote:
> On 9/3/10 10:44 AM, Eric Blake wrote:
>>
>> On 09/02/2010 04:44 PM, Philip Prindeville wrote:
>>>
>>> I wanted to check in and see if there was a chance of this feature being
>>> accepted upstream before I spent any time on it... so here goes.
>>>
>>> The "wait [n]" command is handy, but would be even handier is:
>>>
>>> wait [[-a] n]
>>>
>>> instead, which asynchronously checks to see if process 'n' has completed.
>>
>> What's wrong with using the existing 'kill -0 pid' to check if pid still
>> exists, rather than inventing a new argument to 'wait'?
>>
>
> Well, in theory, if you waited long enough (to look for the process), and it
> had exited and a new process with that id was created, you'd detect the
> wrong process.
>
> At least with 'wait' you're guaranteed it's still in your process-group,
> right?
>
> Besides, 'wait' is just a lot easier to read and understand... not everyone
> knows the system call semantics of kill().
>
>
>
What about kill -0 %jobid instead of pid?