From 3d2df984661269c1335752af8232e8b2248ce4d1 Mon Sep 17 00:00:00 2001 From: James Lopez Date: Tue, 9 Feb 2016 18:19:16 +0100 Subject: workaround for webrick issue on ruby 2.2 --- spec/httpunix_spec.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'spec/httpunix_spec.rb') diff --git a/spec/httpunix_spec.rb b/spec/httpunix_spec.rb index cd2ede9..5f31f6e 100644 --- a/spec/httpunix_spec.rb +++ b/spec/httpunix_spec.rb @@ -24,6 +24,11 @@ class HTTPUNIXServer < WEBrick::HTTPServer socket.close @listeners << server end + + def start(&block) + setup_shutdown_pipe + super.start(&block) + end end def tmp_socket_path -- cgit v1.2.1 From c28af5c6ada34be1b05b7cf8c034949fdb9d5212 Mon Sep 17 00:00:00 2001 From: James Lopez Date: Wed, 10 Feb 2016 13:33:46 +0100 Subject: trying new workaround for shutdown_pipe issue --- spec/httpunix_spec.rb | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'spec/httpunix_spec.rb') 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 -- cgit v1.2.1