From 359d44b6f3b6b7316373e2b5c351943a45bae576 Mon Sep 17 00:00:00 2001 From: Patrick Mahoney Date: Wed, 8 Feb 2012 21:29:03 -0600 Subject: [PATCH] Use original fork in mach unit test rather than possibly overridden fork. --- spec/mach/semaphore_spec.rb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/spec/mach/semaphore_spec.rb b/spec/mach/semaphore_spec.rb index f3bd076..ccf8564 100644 --- a/spec/mach/semaphore_spec.rb +++ b/spec/mach/semaphore_spec.rb @@ -37,7 +37,13 @@ module Mach port.insert_right(:make_send) Task.self.set_bootstrap_port(port) - child = fork do + method = if Process.respond_to?(:__mach_original_fork__) + :__mach_original_fork__ + else + :fork + end + + child = Process.send(method) do parent_port = Task.self.get_bootstrap_port Task.self.copy_send(parent_port) # parent will copy send rights to sem into child task @@ -50,7 +56,7 @@ module Mach start = Time.now.to_f sem.insert_right(:copy_send, :ipc_space => child_task_port) - sem.wait + sem.timedwait(1) elapsed = Time.now.to_f - start Process.wait child