Guest User

Untitled

a guest
Apr 20th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. require 'timeout'
  2. begin
  3. Timeout.timeout(10) {
  4. time_start=Time.now.to_i
  5. puts "hello1"
  6. sleep 5
  7. raise Exception.new("Timeout") if ((Time.now.to_i-time_start))>20
  8. puts "hello2"
  9. sleep 10
  10. }
  11. rescue Timeout::Error
  12. puts ($!).backtrace
  13. end
Add Comment
Please, Sign In to add comment