I had tried checking $? just before cmdout.close, and it had a
value of nil. However, checking it immediately after the
close, it does seem to have $? set to the desired value. As
long as I can depend on this, it will do the job very nicely.
Thanks!
···
At 7:27 AM +0900 11/25/03, Gennady wrote:
Try variable $?, it holds the status of the last executed
command. Works for commands executed with ‘system’, I think
it is valid for popen as well.
–
Garance Alistair Drosehn = gad@gilead.netel.rpi.edu
Senior Systems Programmer or gad@freebsd.org
Rensselaer Polytechnic Institute or drosih@rpi.edu
I had tried checking $? just before cmdout.close, and it had a
value of nil. However, checking it immediately after the
close, it does seem to have $? set to the desired value. As
long as I can depend on this, it will do the job very nicely.
Thanks!
I have implemented a method available through Kernel.launch. It allows
you to execute several commands connecting all of them in a pipeline. I
makes available each command’s return status together with stderr
messages. The last command’s stdout is also available. I haven’t
released it, however if you are interested you can get it at
It has a set of unit tests attached, so it should be easy to figure out
the usage. I am not sure if it works on Windows as it uses fork() and
Process.waitpid2()