From: Shea Martin Date: 2006-03-23T06:04:31+09:00 Subject: Re: Return code of process from IO Farrel Lifson wrote: > Just solved it. Just run Process.wait after the call to the IO.popen > and $? gets updated. This doesn't work in this case: #!/usr/bin/ruby Thread.new{ IO.popen('ls non_existant_dir').each_line{|l| puts l} sleep 10 Process.wait puts "exit status is #{$?}, should be non-zero" } sleep 5 Thread.new{ IO.popen('dir').each_line{|l| puts l} Process.wait puts "exit status is #{$?}, should be 0" } sleep 15 exit 0 ~S