summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Lopez <james@jameslopez.es>2016-02-10 13:33:46 +0100
committerJames Lopez <james@jameslopez.es>2016-02-10 13:33:46 +0100
commitc28af5c6ada34be1b05b7cf8c034949fdb9d5212 (patch)
tree7eaa0a431db32549d8897bbc911b75b117b27526
parent0c25846d9c9a1efe78dfe229a91ed62459e2f9a5 (diff)
downloadgitlab-shell-c28af5c6ada34be1b05b7cf8c034949fdb9d5212.tar.gz
trying new workaround for shutdown_pipe issue
-rw-r--r--spec/httpunix_spec.rb16
1 files changed, 14 insertions, 2 deletions
diff --git a/spec/httpunix_spec.rb b/spec/httpunix_spec.rb
index 5f31f6e..0fcff4a 100644
--- a/spec/httpunix_spec.rb
+++ b/spec/httpunix_spec.rb
@@ -25,9 +25,21 @@ class HTTPUNIXServer < WEBrick::HTTPServer
@listeners << server
end
+ # Workaround:
+ # https://bugs.ruby-lang.org/issues/10956
+ # Affecting Ruby 2.2
+ # Fix for 2.2 is at https://github.com/ruby/ruby/commit/ab0a64e1
+ # However, this doesn't work with 2.1. The following should work for both:
def start(&block)
- setup_shutdown_pipe
- super.start(&block)
+ @shutdown_pipe = IO.pipe
+ shutdown_pipe = @shutdown_pipe
+ super(&block)
+ end
+
+ def cleanup_shutdown_pipe(shutdown_pipe)
+ @shutdown_pipe = nil
+ return if !shutdown_pipe
+ super(shutdown_pipe)
end
end