summaryrefslogtreecommitdiff
path: root/test/ruby/test_process.rb
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2022-09-20 11:12:11 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2022-09-20 11:12:11 +0900
commit55e540f7ab6adb3ea0de16912dfde8e0bf94cc6e (patch)
treedc5a68bc34e620f06102f5735f6e254889004d67 /test/ruby/test_process.rb
parentb4546d26f297d25c0e03f5f09864e7b371d65fa8 (diff)
Ignore EPERM which means already being process-leader
Diffstat (limited to 'test/ruby/test_process.rb')
-rw-r--r--test/ruby/test_process.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/test/ruby/test_process.rb b/test/ruby/test_process.rb
index 6340f622fc..10c4aadadf 100644
--- a/test/ruby/test_process.rb
+++ b/test/ruby/test_process.rb
@@ -1881,17 +1881,19 @@ class TestProcess < Test::Unit::TestCase
if f
assert_equal(f.pid, Process.wait(f.pid))
- dpid, ppid = Integer(f.gets), Integer(f.gets)
+ dpid, ppid, dsid = 3.times.map {Integer(f.gets)}
message = "daemon #{dpid} should be detached"
assert_not_equal($$, ppid, message) # would be 1 almost always
assert_raise(Errno::ECHILD, message) {Process.wait(dpid)}
assert_kind_of(Integer, Process.kill(0, dpid), message)
+ assert_equal(dpid, dsid)
break # close f, and let the daemon resume and exit
end
+ Process.setsid rescue nil
Process.daemon(false, true)
- puts $$, Process.ppid
+ puts $$, Process.ppid, Process.getsid
$stdin.gets # wait for the above assertions using signals
end
end