External programs

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 :slight_smile:

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 [email protected]

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 forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs