summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFUJI Goro <gfuji@cpan.org>2017-07-07 15:36:59 +0900
committerSamuel Williams <samuel.williams@oriontransfer.co.nz>2020-02-05 18:22:02 +1300
commit6c4d23da3a7cfee71a1c3bfcfadb6c9aec0880f3 (patch)
tree722ee947b781c750bc824009f51c22db9c06b5bf
parentdbced5bfaa06904ef89ad8a7d29d4605c4041062 (diff)
downloadrack-6c4d23da3a7cfee71a1c3bfcfadb6c9aec0880f3.tar.gz
avoid errors: undefined method `shutdown' for nil:NilClass (NoMethodError)
when SIGINT is sent multiple times to the webrick handler, the server crashes.
-rw-r--r--lib/rack/handler/webrick.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/rack/handler/webrick.rb b/lib/rack/handler/webrick.rb
index 6161a5a7..d2f38975 100644
--- a/lib/rack/handler/webrick.rb
+++ b/lib/rack/handler/webrick.rb
@@ -52,8 +52,10 @@ module Rack
end
def self.shutdown
- @server.shutdown
- @server = nil
+ if @server
+ @server.shutdown
+ @server = nil
+ end
end
def initialize(server, app)