From 3f5bbc8516073d6af7b6d2aa9b46bc09af57c880 Mon Sep 17 00:00:00 2001 From: Lamont Granquist Date: Wed, 25 Nov 2015 12:17:05 -0800 Subject: fix rspecs-ctrl-c we can't fork off tinyserver without a lot of work in the test codebase, so instead save a copy of the old rspec signal handler and then after tinyserver has started (and we're sure that rack has scribbled over the signal handler), restore the rspec signal handler. there's an obvious race if someone hits ctrl-c after tinyserver has scribbled over the sigint handler but before we restore it, but this is 99.9% better of a solution than nothing. --- spec/tiny_server.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spec/tiny_server.rb b/spec/tiny_server.rb index a2cfe168d5..c28fdc30b3 100644 --- a/spec/tiny_server.rb +++ b/spec/tiny_server.rb @@ -1,6 +1,6 @@ # # Author:: Daniel DeLeo () -# Copyright:: Copyright (c) 2010 Opscode, Inc. +# Copyright:: Copyright (c) 2010-2015 Chef Software, Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -66,9 +66,11 @@ module TinyServer @server = Server.setup(@options) do run API.instance end + @old_handler = trap(:INT, "EXIT") @server.start end block_until_started + trap(:INT, @old_handler) end def url -- cgit v1.2.1