From: Robert Klemme Date: 2003-02-27T21:19:10+09:00 Subject: Re: Threads, pipes, popen, whatever "Brian Candler" schrieb im Newsbeitrag news:20030227105024.A89394@linnet.org... > On Thu, Feb 27, 2003 at 06:57:18PM +0900, Michael Shigorin wrote: > > On Tue, Feb 25, 2003 at 05:52:08PM +0900, Robert Klemme wrote: > > > Normally you would use IO.popen but I can't see a way to access > > > the exit status of the process directly. > > > > $? won't work? > > It does appear to work as advertised: Thanks for the hint! > f = IO.popen("/usr/bin/false","w") > f.write "ignoreme" > f.close > puts $? #>> 256 > > It would be nice if the status hung around as an instance variable of f > though. Yes, I did not think of looking for a global variable. This is a nice example of the drawbacks: If two threads use popen you can't be sure any more that the value you read from $? is the correct one. Kind regards robert