there's a version of rc on sources (/n/sources/contrib/quanstro/rc-wait.tbz)
that keeps careful track of waits so "wait $pid" should be dependable,
at least in the basic approach, i did minimal minimal testing of the details.
there is somewhat verbose information printed along these lines:
; sleep & sleep & sleep & sleep
waitqadd(772665)
waitqadd(772666)
waitqadd(772667)
waitqadd(772668)
waitfor 772668
w->pid 772668
waitqrm(772668)
Xreturn i=0; p 205256, i=1
broken! wait 772665
waitfor 772665
w->pid 772667
w->pid 772666
w->pid 772665
waitqrm(772665)
Xreturn i=0; p 205256, i=1
broken! wait 772666
waitfor 772666
Xreturn i=0; p 205256, i=1
broken!
this output can be supressed by redefining the wdebug macro in exec.h.
the previous case of
; sleep $longtime &
; echo&echo&echo&
; wait $apid
should illustrate the difference.
- erik