Permalink
Browse files

$? is thread-local in 1.9

  • Loading branch information...
1 parent 213d862 commit 0a65ce9bf500cbc6ddd2518151f63a055d188783 @jfirebaugh jfirebaugh committed May 7, 2012
Showing with 15 additions and 0 deletions.
  1. +15 −0 spec/ruby/language/predefined_spec.rb
@@ -454,6 +454,21 @@ def obj.foo2; yield; end
$? = nil
}.should raise_error(NameError)
end
+
+ ruby_version_is ""..."1.9" do
+ it "is shared across threads" do
+ system("true")
+ pid = $?.pid
+ Thread.new { $?.pid.should == pid }.join
+ end
+ end
+
+ ruby_version_is "1.9" do
+ it "is thread-local" do
+ system("true")
+ Thread.new { $?.should be_nil }.join
+ end
+ end
end
describe "Global variable $-a" do

0 comments on commit 0a65ce9

Please sign in to comment.