master/lib/guard/interactor.rb
Thibaud Guillaume-Gentil c347c2c7e0 Added 1.8.6 compatibility
Closes #2.
2010-10-18 21:45:31 +02:00

32 lines
660 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| g.run_all }
end
end
# Stop (Ctrl-C)
Signal.trap('INT') do
::Guard.listener.stop
if ::Guard.guards.all? { |g| g.stop }
UI.info "Bye bye...", :reset => true
abort("\n")
else
::Guard.listener.start
end
end
# Reload (Ctrl-Z)
Signal.trap('TSTP') do
::Guard.run do
::Guard.guards.each { |g| g.reload }
end
end
end
end
end