Created
January 17, 2014 19:12
-
-
Save doxavore/8479551 to your computer and use it in GitHub Desktop.
JRuby (tested on 1.7.4 and 1.7.9) exits after 10 seconds. MRI exits after 5 seconds.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'timeout' | |
puts "Starting at #{Time.now}" | |
begin | |
Timeout.timeout(5) do | |
`sleep 10` | |
puts 'after sleep' | |
end | |
rescue Timeout::Error | |
puts 'timed out' | |
end | |
puts "Ending at #{Time.now}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment