bug-bash
[Top][All Lists]
Advanced

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

Re: `wait -n` returns 127 when it shouldn't


From: Oğuz İsmail Uysal
Subject: Re: `wait -n` returns 127 when it shouldn't
Date: Wed, 17 May 2023 13:20:33 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0

On 5/16/23 8:35 PM, Aleksey Covacevice wrote:
waitjobs() { local status=0 while true; do local code=0; wait -n || code=$? ((code == 127)) && break ((!code)) || status=$code done return $status } # Eventually finishes: while true; do ( true & false & waitjobs ) && break; done
This boils down to the following

    true &
    false &
    wait -n

There is no guarantee that `wait -n' will report the status of `true', the shell may acquire the status of `false' first. It's not a bug.



reply via email to

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