Garance A Drosihn
11/25/2003 12:23:00 AM
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.
Interesting. In the code sequence of:
cmdout = IO.popen(somecmd, "r")
cmdout.each_line {|aline|
# Do Stuff...
}
cmdout.close
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!
--
Garance Alistair Drosehn = gad@gilead.netel.rpi.edu
Senior Systems Programmer or gad@freebsd.org
Rensselaer Polytechnic Institute or drosih@rpi.edu