diff --git a/Library/Homebrew/test.rb b/Library/Homebrew/test.rb
index fc09ba2e9f48048e078bee34aa62d7d60f03e5ce..aad5e5bb2a3576d8de90bec3b980de3d76d2d20e 100644
--- a/Library/Homebrew/test.rb
+++ b/Library/Homebrew/test.rb
@@ -46,7 +46,7 @@ rescue Exception => e # rubocop:disable Lint/RescueException
   error_pipe.close
 ensure
   pid = Process.pid.to_s
-  if which("pgrep") && which("pkill") && system("pgrep", "-P", pid, out: :close)
+  if which("pgrep") && which("pkill") && system("pgrep", "-P", pid, :out => File::NULL)
     $stderr.puts "Killing child processes..."
     system "pkill", "-P", pid
     sleep 1