Skip to content

Commit

Permalink
Ignore SIGHUP when no restart block is given
Browse files Browse the repository at this point in the history
  • Loading branch information
macournoyer committed Mar 16, 2010
1 parent 85e9ef5 commit 6241001
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG
@@ -1,3 +1,6 @@
== 1.2.8 Does It Offend You, Yeah?
* Ignore SIGHUP when no restart block is given

== 1.2.7 No Hup
* Support multiple Ruby version (fat binaries under windows)
* Do not trap unsupported HUP signal on Windows
Expand Down
13 changes: 7 additions & 6 deletions lib/thin/daemonizing.rb
Expand Up @@ -83,12 +83,13 @@ def on_restart(&block)

# Restart the server.
def restart
raise ArgumentError, "Can't restart, no 'on_restart' proc specified" unless @on_restart
log '>> Restarting ...'
stop
remove_pid_file
@on_restart.call
exit!
if @on_restart
log '>> Restarting ...'
stop
remove_pid_file
@on_restart.call
exit!
end
end

module ClassMethods
Expand Down
4 changes: 2 additions & 2 deletions lib/thin/version.rb
Expand Up @@ -6,11 +6,11 @@ class PlatformNotSupported < RuntimeError; end
module VERSION #:nodoc:
MAJOR = 1
MINOR = 2
TINY = 7
TINY = 8

STRING = [MAJOR, MINOR, TINY].join('.')

CODENAME = "No Hup".freeze
CODENAME = "Does It Offend You, Yeah?".freeze

RACK = [1, 0].freeze # Rack protocol version
end
Expand Down
4 changes: 4 additions & 0 deletions spec/daemonizing_spec.rb
Expand Up @@ -150,6 +150,10 @@ def name
proc { sleep 0.1 while File.exist?(@server.pid_file) }.should take_less_then(10)
end

it "should ignore if no restart block specified" do
TestServer.restart(@server.pid_file)
end

it "should not restart when not running" do
silence_stream STDOUT do
TestServer.restart(@server.pid_file)
Expand Down

0 comments on commit 6241001

Please sign in to comment.