Yohanes Santoso
7/11/2006 7:53:00 PM
Name Name <exl2@cornell.edu> writes:
> a=IO.popen("program > logfile"), but on Windows this creates two
> processes, cmd.exe and program. a.pid only gives the pid of cmd.exe.
> And the behavior on *nix seems to be just the program (although I can be
> wrong).
The behaviour in *nix depends on your /bin/sh. Some shells gives the
child's pid, other gives the pid of itself.
pdksh gives the pid of itself.
bash gives the pid of the child (the behaviour you wanted).
Don't know about other shells.
The lesson here, you can't get the pid of the child consistently
unless you do the forking yourself.
YS