From 7f721b1608882afa15c28be0ec6071fb1e4e5872 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 20 Nov 2011 02:21:44 +0000 Subject: [PATCH] test/exec: close-on-exec all Tempfiles --- test/exec.rb | 5 +++++ 1 file changed, 5 insertions(+) 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) -- 2.11.4.GIT