master/lib/guard/interactor.rb
Thibaud Guillaume-Gentil 2fc6745837 Merge branch 'master' of github.com:guard/guard
Conflicts:
	lib/guard.rb
	lib/guard/interactor.rb
	spec/guard_spec.rb
2010-11-30 21:23:53 +01:00

29 lines
700 B
Ruby

module Guard
module Interactor
def self.init_signal_traps
# Run all (Ctrl-\)
Signal.trap('QUIT') do
::Guard.run do
::Guard.guards.each { |guard| ::Guard.supervised_task(guard, :run_all) }
end
end
# Stop (Ctrl-C)
Signal.trap('INT') do
UI.info "Bye bye...", :reset => true
::Guard.listener.stop
::Guard.guards.each { |guard| ::Guard.supervised_task(guard, :stop) }
abort("\n")
end
# Reload (Ctrl-Z)
Signal.trap('TSTP') do
::Guard.run do
::Guard.guards.each { |guard| ::Guard.supervised_task(guard, :reload) }
end
end
end
end
end