From: Eric Wong <bofh@yhbt.net> To: unicorn-public@yhbt.net Subject: [PATCH 3/3] test_upload: use spawn to simplify redirects Date: Sun, 26 Jan 2020 05:33:33 +0000 [thread overview] Message-ID: <20200126053333.28163-4-bofh@yhbt.net> (raw) In-Reply-To: <20200126053333.28163-1-bofh@yhbt.net> We can start using Ruby 1.9 APIs, nowadays (right?) --- test/unit/test_upload.rb | 13 ++++--------- 1 file 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 @@ def test_chunked_upload_via_curl 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
prev parent reply other threads:[~2020-01-26 5:33 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-01-26 5:33 [PATCH 0/3] minor test golfing to make worktree smaller Eric Wong 2020-01-26 5:33 ` [PATCH 1/3] test/exec/test_exec: bring worker_processes down to 2 Eric Wong 2020-01-26 5:33 ` [PATCH 2/3] test_helper: remove unused `chunked_spawn' Eric Wong 2020-01-26 5:33 ` Eric Wong [this message]
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style List information: https://yhbt.net/unicorn/ * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20200126053333.28163-4-bofh@yhbt.net \ --to=bofh@yhbt.net \ --cc=unicorn-public@yhbt.net \ --subject='Re: [PATCH 3/3] test_upload: use spawn to simplify redirects' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Code repositories for project(s) associated with this inbox: ../../unicorn.git This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).