summaryrefslogtreecommitdiff
path: root/spec/httpunix_spec.rb
diff options
context:
space:
mode:
authorJacob Vosmaer <contact@jacobvosmaer.nl>2016-02-10 13:34:52 +0000
committerJacob Vosmaer <contact@jacobvosmaer.nl>2016-02-10 13:34:52 +0000
commitff31080b0d5b5e7c99bfe7738aaa2bb1fafe60fb (patch)
tree7eaa0a431db32549d8897bbc911b75b117b27526 /spec/httpunix_spec.rb
parent6a88498bf9175276aaf09976dfd19f312454fc05 (diff)
parentc28af5c6ada34be1b05b7cf8c034949fdb9d5212 (diff)
downloadgitlab-shell-ff31080b0d5b5e7c99bfe7738aaa2bb1fafe60fb.tar.gz
Merge branch 'fix/ruby-2.2-webrick' into 'master'
workaround for webrick issue on ruby 2.2 Workaround that fixes https://gitlab.com/gitlab-org/gitlab-shell/issues/36 See merge request !38
Diffstat (limited to 'spec/httpunix_spec.rb')
-rw-r--r--spec/httpunix_spec.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/spec/httpunix_spec.rb b/spec/httpunix_spec.rb
index cd2ede9..0fcff4a 100644
--- a/spec/httpunix_spec.rb
+++ b/spec/httpunix_spec.rb
@@ -24,6 +24,23 @@ class HTTPUNIXServer < WEBrick::HTTPServer
socket.close
@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)
+ @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
def tmp_socket_path