summaryrefslogtreecommitdiff
path: root/test/ruby/test_fiber.rb
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2022-01-19 16:01:45 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2022-01-19 19:57:16 +0900
commitd650b17686d49c2ce8e6a87039861154e93d4621 (patch)
treed118492480903dfa666ca3c407cc0e6c9698c8aa /test/ruby/test_fiber.rb
parent5c7af72304d0ad33cd3f21b24a4bc44e8acd5b2c (diff)
`rb_fiber_terminate` must not return [Bug #18497]
In a forked process from a fiber, the fiber becomes the only fiber, `fiber_switch` does nothing as there is no other fibers, `rb_fiber_terminate` does not terminate the fiber. In that case, reaches the end of `fiber_entry` finaly, which is declared as "COROUTINE" and should never return.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/5468
Diffstat (limited to 'test/ruby/test_fiber.rb')
-rw-r--r--test/ruby/test_fiber.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/test/ruby/test_fiber.rb b/test/ruby/test_fiber.rb
index 1447a036c3..5825aaf6cc 100644
--- a/test/ruby/test_fiber.rb
+++ b/test/ruby/test_fiber.rb
@@ -407,6 +407,11 @@ class TestFiber < Test::Unit::TestCase
pid, status = Process.waitpid2(pid)
assert_not_predicate(status, :signaled?, bug5700)
assert_predicate(status, :success?, bug5700)
+
+ pid = Fiber.new {fork}.resume
+ pid, status = Process.waitpid2(pid)
+ assert_not_predicate(status, :signaled?)
+ assert_predicate(status, :success?)
end
def test_exit_in_fiber