Forum: Ruby on Rails external programs

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Svetlana V. (Guest)
on 2009-04-15 18:41
how i can follow to execute external programs: define, that they don't
hung with Kernel method system or another? may be use timeout?

excuse me for my bad english :)
BenH (Guest)
on 2009-04-15 19:16
(Received via mailing list)
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

On Apr 15, 7:41 am, Svetlana Vt <removed_email_address@domain.invalid>
BenH (Guest)
on 2009-04-15 19:29
(Received via mailing list)
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
This topic is locked and can not be replied to.