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.
1042dba6177fdc7b7fa1279215cd6a2e?d=identicon&s=25 Svetlana Vt (svetlana)
on 2009-04-15 16: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 :)
B0f6756b62559d43213636dde11bb785?d=identicon&s=25 BenH (Guest)
on 2009-04-15 17: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 <rails-mailing-l...@andreas-s.net>
B0f6756b62559d43213636dde11bb785?d=identicon&s=25 BenH (Guest)
on 2009-04-15 17: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.