rearrange some watcher stuff
This commit is contained in:
parent
2c42cb4930
commit
73bcd4c12f
|
@ -40,6 +40,7 @@ module Middleman
|
||||||
$LOAD_PATH << File.expand_path('../../middleman-core/vendor/linux/lib', __FILE__)
|
$LOAD_PATH << File.expand_path('../../middleman-core/vendor/linux/lib', __FILE__)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
register_signal_handlers
|
||||||
start
|
start
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -63,7 +64,9 @@ module Middleman
|
||||||
bootup
|
bootup
|
||||||
else
|
else
|
||||||
@server_job = fork {
|
@server_job = fork {
|
||||||
Signal.trap(::Middleman::WINDOWS ? :KILL : :TERM) { exit! }
|
trap("INT") { exit(0) }
|
||||||
|
trap("TERM") { exit(0) }
|
||||||
|
trap("QUIT") { exit(0) }
|
||||||
bootup
|
bootup
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
@ -95,8 +98,8 @@ module Middleman
|
||||||
puts "== The Middleman is shutting down"
|
puts "== The Middleman is shutting down"
|
||||||
if !@options[:"disable-watcher"]
|
if !@options[:"disable-watcher"]
|
||||||
Process.kill(::Middleman::WINDOWS ? :KILL : :TERM, @server_job)
|
Process.kill(::Middleman::WINDOWS ? :KILL : :TERM, @server_job)
|
||||||
Process.wait @server_job
|
# Process.wait @server_job
|
||||||
@server_job = nil
|
# @server_job = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -134,6 +137,13 @@ module Middleman
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
# Trap the interupt signal and shut down FSSM (and thus the server) smoothly
|
||||||
|
def register_signal_handlers
|
||||||
|
trap("INT") { stop; exit(0) }
|
||||||
|
trap("TERM") { stop; exit(0) }
|
||||||
|
trap("QUIT") { stop; exit(0) }
|
||||||
|
end
|
||||||
|
|
||||||
# Whether the passed files are config.rb, lib/*.rb or helpers
|
# Whether the passed files are config.rb, lib/*.rb or helpers
|
||||||
# @param [Array<String>] paths Array of paths to check
|
# @param [Array<String>] paths Array of paths to check
|
||||||
# @return [Boolean] Whether the server needs to reload
|
# @return [Boolean] Whether the server needs to reload
|
||||||
|
@ -152,9 +162,3 @@ module Middleman
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Trap the interupt signal and shut down FSSM (and thus the server) smoothly
|
|
||||||
trap(::Middleman::Watcher.kill_command) do
|
|
||||||
::Middleman::Watcher.singleton.stop
|
|
||||||
exit(0)
|
|
||||||
end
|
|
Loading…
Reference in a new issue