about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <bofh@yhbt.net>2020-01-20 09:54:21 +0000
committerEric Wong <bofh@yhbt.net>2020-01-20 10:01:47 +0000
commitcca935955422a2c00061cdd80c58910efa4b12f7 (patch)
treecb3f096a4002d8c2c2d7205fd47914965ab4e737
parente5231b624227cba11ab6cf0825ff3daf328eebd7 (diff)
downloadunicorn-cca935955422a2c00061cdd80c58910efa4b12f7.tar.gz
We can start using Ruby 1.9 APIs, nowadays
-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