Hi,
In message "[ruby-talk:03401] Re: PID of child processes"
on 00/06/14, Andrew Hunt <andy / Toolshed.Com> writes:
| >Using $?,
| >
| > trap("CHLD"){Process.wait; ..using $? ..}
| >
| >should work fine. In addition, this variable is thread independent.
|
|But isn't there a race condition there?
I don't think so. The value of $? is set only on occasions such as
wait, system and backticks (``). So if you don't mix system, `` and
other subprocesses, you can trust $? was set by the last Process.wait,
which returns PID.
Mixing trap("CHLD") with system and backticks is not a good idea
anyway.
matz.