Created
January 14, 2011 09:24
-
-
Save deepak/779402 to your computer and use it in GitHub Desktop.
Thread#kill works as a script but not in irb
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
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