external programs

you may try something along this line:

timeout(10) do
  %x{sleep 12}

rescue Timeout::Error
  # Do something to handle the time out.
  puts "The sleep command timed out"

Hope that gets you going in a good direction.

Excuse the self reply - something that comes in handy is to capture
the exit status of the external application. To do this use

%x{echo "Hello World"}
puts $?.exitstatus