Hi

I've been able to launch an external program and read standard output
using the following code.

IO.popen("program.exe", 'r+') do |io|
  io.puts "command line input"
  io.close_write
  puts io.read
end

1) How would I add a timeout to the command (e.g. 10 seconds)?
2) How would I check the error level (e.g. 0, 1, etc)?
3) How would I read standard error?

Thanks