Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'timeout'
- begin
- Timeout.timeout(10) {
- time_start=Time.now.to_i
- puts "hello1"
- sleep 5
- raise Exception.new("Timeout") if ((Time.now.to_i-time_start))>20
- puts "hello2"
- sleep 10
- }
- rescue Timeout::Error
- puts ($!).backtrace
- end
Add Comment
Please, Sign In to add comment