From afa512d9e18d39b2e727a0ee1a792f21505779bb Mon Sep 17 00:00:00 2001 From: normal Date: Fri, 12 Sep 2014 19:42:01 +0000 Subject: Process.detach: avoid singleton class creation * process.c (Init_process): subclass Thread as Process::Waiter (rb_detach_process): use Process::Waiter instead of singleton class * test/ruby/test_process.rb (test_process_detach): new test * inits.c (rb_call_inits): call Init_Thread before Init_process to ensure Process::Waiter may be a subclass of Thread Thanks to headius for reporting [Bug #10231] Thanks to nobu for review of my initial patch. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47561 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_process.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'test') diff --git a/test/ruby/test_process.rb b/test/ruby/test_process.rb index 608d663027..0530c8d088 100644 --- a/test/ruby/test_process.rb +++ b/test/ruby/test_process.rb @@ -1965,4 +1965,12 @@ EOS runner.close end end if defined?(fork) + + def test_process_detach + pid = fork {} + th = Process.detach(pid) + assert_equal pid, th.pid + status = th.value + assert status.success?, status.inspect + end if defined?(fork) end -- cgit v1.2.3