Skip to content

Instantly share code, notes, and snippets.

@deepak
Created January 14, 2011 09:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deepak/779402 to your computer and use it in GitHub Desktop.
Save deepak/779402 to your computer and use it in GitHub Desktop.
Thread#kill works as a script but not in irb
t = Thread.new { kill }
puts t.inspect
# irb eval's code. but then this works as a script but does not work in irb
# eval "t = Thread.new { kill }; puts t.inspect"
__END__
runs successfully when run as a script ie. ruby <filename>
#<Thread:0x1dc5090 dead>
But running it on irb gives an error
> load '/tmp/baz.rb'
=> #<Thread:0x2813678 dead>
IRB::NoSuchJob: No such job(#<Thread:0x243e278>).
from :0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment