mirror of
https://github.com/puma/puma.git
synced 2022-11-09 13:48:40 -05:00
parent
55a4753754
commit
e289c41493
2 changed files with 11 additions and 0 deletions
|
@ -242,6 +242,12 @@ module Puma
|
|||
ENV['RACK_ENV'] = @options[:environment] || ENV['RACK_ENV'] || 'development'
|
||||
end
|
||||
|
||||
def delete_pidfile
|
||||
if path = @options[:pidfile]
|
||||
File.unlink path
|
||||
end
|
||||
end
|
||||
|
||||
def write_state
|
||||
require 'yaml'
|
||||
|
||||
|
@ -274,6 +280,7 @@ module Puma
|
|||
def graceful_stop(server)
|
||||
log " - Gracefully stopping, waiting for requests to finish"
|
||||
server.stop(true)
|
||||
delete_pidfile
|
||||
log " - Goodbye!"
|
||||
end
|
||||
|
||||
|
@ -456,6 +463,7 @@ module Puma
|
|||
|
||||
def stop
|
||||
@server.stop(true) if @server
|
||||
delete_pidfile
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -27,6 +27,9 @@ class TestCLI < Test::Unit::TestCase
|
|||
cli.write_pid
|
||||
|
||||
assert_equal File.read(@tmp_path).strip.to_i, Process.pid
|
||||
|
||||
cli.stop
|
||||
assert !File.exist?(@tmp_path), "Pid file shouldn't exist anymore"
|
||||
end
|
||||
|
||||
def test_control_for_tcp
|
||||
|
|
Loading…
Reference in a new issue