From cca935955422a2c00061cdd80c58910efa4b12f7 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 20 Jan 2020 09:54:21 +0000 Subject: test_upload: use spawn to simplify redirects We can start using Ruby 1.9 APIs, nowadays --- test/unit/test_upload.rb | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'test') 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 -- cgit v1.2.3-24-ge0c7