about summary refs log tree commit homepage
diff options
context:
space:
mode:
-rw-r--r--test/unit/test_upload.rb13
1 files changed, 4 insertions, 9 deletions
diff --git a/test/unit/test_upload.rb b/test/unit/test_upload.rb
index 5de02e4..8d90e50 100644
--- a/test/unit/test_upload.rb
+++ b/test/unit/test_upload.rb
@@ -236,15 +236,10 @@ class UploadTest < Test::Unit::TestCase
     resp = Tempfile.new('resp')
     resp.sync = true
 
-    rd, wr = IO.pipe
-    wr.sync = rd.sync = true
-    pid = fork {
-      STDIN.reopen(rd)
-      rd.close
-      wr.close
-      STDOUT.reopen(resp)
-      exec cmd
-    }
+    rd, wr = IO.pipe.each do |io|
+      io.sync = io.close_on_exec = true
+    end
+    pid = spawn(*cmd, { 0 => rd, 1 => resp })
     rd.close
 
     tmp.rewind