external programs

you may try something along this line:

timeout(10) do
  %x{sleep 12}
end

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

Hope that gets you going in a good direction.
BenH

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

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