about summary refs log tree commit homepage
diff options
context:
space:
mode:
-rw-r--r--test/exec.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/test/exec.rb b/test/exec.rb
index d84713e..6a6c832 100644
--- a/test/exec.rb
+++ b/test/exec.rb
@@ -38,6 +38,11 @@ module TestExec
       $stdout.reopen(out.path, "a")
       out.close
       err.close
+      ObjectSpace.each_object(Tempfile) do |tmp|
+        next if tmp.closed?
+        ObjectSpace.undefine_finalizer(tmp)
+        tmp.close_on_exec = true if tmp.respond_to?(:close_on_exec=)
+      end
       exec(*cmd)
     end
     _, status = Process.waitpid2(pid)