diff options
author | Eric Wong <bofh@yhbt.net> | 2021-03-15 02:03:50 -0400 |
---|---|---|
committer | Eric Wong <bofh@yhbt.net> | 2021-03-15 02:03:50 -0400 |
commit | 9c4963c8b1f96fa6afcfa8ec61f81f9997e926e7 (patch) | |
tree | 0b024787954128ca4fc76d0d41dbdacf6254323d /test/test_helper.rb | |
parent | 2c9038cdc129272161336c0bd4facf61a681062e (diff) | |
parent | ea5295e8e4dcfaec24efb5030557594aabe645cb (diff) | |
download | unicorn-9c4963c8b1f96fa6afcfa8ec61f81f9997e926e7.tar.gz |
* origin/master: tests: force blocking I/O for Ruby 3.x
Diffstat (limited to 'test/test_helper.rb')
-rw-r--r-- | test/test_helper.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/test_helper.rb b/test/test_helper.rb index ba5ef16..d86f83b 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -28,6 +28,7 @@ require 'tempfile' require 'fileutils' require 'logger' require 'unicorn' +require 'io/nonblock' if ENV['DEBUG'] require 'ruby-debug' @@ -291,3 +292,15 @@ def reset_sig_handlers trap(sig, "DEFAULT") end end + +def tcp_socket(*args) + sock = TCPSocket.new(*args) + sock.nonblock = false + sock +end + +def unix_socket(*args) + sock = UNIXSocket.new(*args) + sock.nonblock = false + sock +end |