cb8b845eb6
Every guard task are now executed through supervised_task method. If a guard failed to achieve its task(raise error) a message is logged and the guard is fired. The stop method now always quit the application at the end. Specs added. The documentation specify that if a throw an exception, it will be dismissed.
29 lines
673 B
Ruby
29 lines
673 B
Ruby
module Guard
|
|
module Interactor
|
|
|
|
def self.init_signal_traps
|
|
# Run all (Ctrl-\)
|
|
Signal.trap('QUIT') do
|
|
::Guard.run do
|
|
::Guard.guards.each { |g| ::Guard.supervised_task g, :run_all }
|
|
end
|
|
end
|
|
|
|
# Stop (Ctrl-C)
|
|
Signal.trap('INT') do
|
|
::Guard.listener.stop
|
|
::Guard.guards.each { |g| ::Guard.supervised_task g, :stop }
|
|
UI.info "Bye bye...", :reset => true
|
|
abort("\n")
|
|
end
|
|
|
|
# Reload (Ctrl-Z)
|
|
Signal.trap('TSTP') do
|
|
::Guard.run do
|
|
::Guard.guards.each { |g| ::Guard.supervised_task g, :reload }
|
|
end
|
|
end
|
|
end
|
|
|
|
end
|
|
end |