From: Garance A Drosihn Date: 2003-11-25T07:08:51+09:00 Subject: Exit status on cmd executed via popen() Sometimes I write ruby scripts to filter the output of some other command. So I write something like: cmdout = IO.popen(somecmd, "r") cmdout.each_line {|aline| # Do Stuff... } cmdout.close Is there any way to find out what the exit status was from the command given to popen? It would be nice to have some method that I could use like: if cmdout.popen_exit_status != 0 # Do Error-processing stuff end which could be done after reading all the lines, but before the call to 'close'. Or do I need to do something more complicated than 'popen' if I need to know the exit code from that command? -- Garance Alistair Drosehn = gad@gilead.netel.rpi.edu Senior Systems Programmer or gad@freebsd.org Rensselaer Polytechnic Institute or drosih@rpi.edu