unicorn Ruby/Rack server user+dev discussion/patches/pulls/bugs/help
 help / color / Atom feed
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
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

      parent reply index

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 \
    /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

unicorn Ruby/Rack server user+dev discussion/patches/pulls/bugs/help

Archives are clonable:
	git clone --mirror https://yhbt.net/unicorn-public
	git clone --mirror http://ou63pmih66umazou.onion/unicorn-public

Example config snippet for mirrors

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.lang.ruby.unicorn
	nntp://ou63pmih66umazou.onion/inbox.comp.lang.ruby.unicorn

 note: .onion URLs require Tor: https://www.torproject.org/

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git