Skip to content

Instantly share code, notes, and snippets.

@no6v
Created December 25, 2011 02:02
Show Gist options
  • Save no6v/1518627 to your computer and use it in GitHub Desktop.
Save no6v/1518627 to your computer and use it in GitHub Desktop.
require "eventmachine"
EventMachine.run do
Thread.new do
begin
system("cat")
rescue Exception => e
p e
ensure
EventMachine.stop_event_loop
end
end
end
$ ruby -v em.rb
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-linux]
^C$
$
$ ruby -v em.rb
ruby 2.0.0dev (2011-12-25 trunk 34120) [x86_64-linux]
^C/home/nov/.rvm/gems/ruby-head@earthquake/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run_machine': Interrupt
from /home/nov/.rvm/gems/ruby-head@earthquake/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run'
from em.rb:3:in `<main>'
$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment