> Subject: Bug#294078: bash: wait neglects short-lived children (POSIX > violation) > > Package: bash > Version: 3.0-14 > Severity: normal > > POSIX/SUS specifies that shells should keep track of children that > have already exited [up to a limit of sysconf(_SC_CHILD_MAX)] for use > by the wait builtin, to avoid possible race conditions. However, bash > only supports waiting for children that are still alive, even when > invoked with --posix.
The current development version of bash-3.1 behaves as I think you want: z3.local(2)$ cat x2 exit 125 & e=$! sleep 2 & wait $! echo $? wait $e echo $? wait $e echo $? z3.local(2)$ ./sh ./x2 0 125 125 It's an extension. Bash is allowed to discard the status of terminated processes after the calling shell script obtains them via wait, and bash-3.0 does so when job control is not active. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ( ``Discere est Dolere'' -- chet ) Live Strong. Chet Ramey, ITS, CWRU [EMAIL PROTECTED] http://cnswww.cns.cwru.edu/~chet/ -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]