master/lib/guard/interactor.rb

29 lines
673 B
Ruby
Raw Normal View History

2010-10-03 21:00:33 +00:00
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 }
2010-10-03 21:00:33 +00:00
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")
2010-10-03 21:00:33 +00:00
end
# Reload (Ctrl-Z)
Signal.trap('TSTP') do
::Guard.run do
::Guard.guards.each { |g| ::Guard.supervised_task g, :reload }
2010-10-03 21:00:33 +00:00
end
end
end
end
end