summaryrefslogtreecommitdiff
path: root/spec/rubyspec/shared/process/exit.rb
diff options
context:
space:
mode:
authoreregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-09-14 15:56:33 +0000
committereregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-09-14 15:56:33 +0000
commit6479a0163aa798ae379962c6b52f6410b11995cc (patch)
tree2a63962dc9a2f66cbb4804b4d2bc4680ed00ab3b /spec/rubyspec/shared/process/exit.rb
parent938465beb05d481b424e9b06a19124c22a881ee0 (diff)
Update to ruby/spec@a4bc1d8
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59911 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'spec/rubyspec/shared/process/exit.rb')
-rw-r--r--spec/rubyspec/shared/process/exit.rb30
1 files changed, 14 insertions, 16 deletions
diff --git a/spec/rubyspec/shared/process/exit.rb b/spec/rubyspec/shared/process/exit.rb
index a5c9eca665..7d567c8195 100644
--- a/spec/rubyspec/shared/process/exit.rb
+++ b/spec/rubyspec/shared/process/exit.rb
@@ -74,23 +74,21 @@ describe :process_exit, shared: true do
end
describe :process_exit!, shared: true do
- with_feature :fork do
- it "exits with the given status" do
- pid = Process.fork { @object.exit!(1) }
- pid, status = Process.waitpid2(pid)
- status.exitstatus.should == 1
- end
-
- it "exits when called from a thread" do
- pid = Process.fork do
- Thread.new { @object.exit!(1) }.join
+ it "exits with the given status" do
+ out = ruby_exe("#{@object}.send(:exit!, 21)", args: '2>&1')
+ out.should == ""
+ $?.exitstatus.should == 21
+ end
- # Do not let the main thread complete
- sleep
- end
+ it "exits when called from a thread" do
+ out = ruby_exe("Thread.new { #{@object}.send(:exit!, 21) }.join; sleep", args: '2>&1')
+ out.should == ""
+ $?.exitstatus.should == 21
+ end
- pid, status = Process.waitpid2(pid)
- status.exitstatus.should == 1
- end
+ it "exits when called from a fiber" do
+ out = ruby_exe("Fiber.new { #{@object}.send(:exit!, 21) }.resume", args: '2>&1')
+ out.should == ""
+ $?.exitstatus.should == 21
end
end