about summary refs log tree commit homepage
diff options
context:
space:
mode:
-rw-r--r--test/test_helper.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/test/test_helper.rb b/test/test_helper.rb
index 974d2f2..ba5ef16 100644
--- a/test/test_helper.rb
+++ b/test/test_helper.rb
@@ -42,6 +42,7 @@ end
 def redirect_test_io
   orig_err = STDERR.dup
   orig_out = STDOUT.dup
+  rdr_pid = $$
   new_out = File.open("test_stdout.#$$.log", "a")
   new_err = File.open("test_stderr.#$$.log", "a")
   new_out.sync = new_err.sync = true
@@ -59,8 +60,10 @@ def redirect_test_io
   STDERR.sync = STDOUT.sync = true
 
   at_exit do
-    File.unlink(new_out.path) rescue nil
-    File.unlink(new_err.path) rescue nil
+    if rdr_pid == $$
+      File.unlink(new_out.path) rescue nil
+      File.unlink(new_err.path) rescue nil
+    end
   end
 
   begin