Skip to content
This repository has been archived by the owner on Aug 14, 2018. It is now read-only.

Commit

Permalink
Don't spew stack traces on CTRL-C
Browse files Browse the repository at this point in the history
  • Loading branch information
freshtonic committed Aug 27, 2011
1 parent e80cfc6 commit 628bc0b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
7 changes: 6 additions & 1 deletion bin/bananajour
Expand Up @@ -28,7 +28,12 @@ when nil
pids << Bananajour.serve_web!
pids << Bananajour.serve_git!
pids << Bananajour.advertise!
Process.waitall

begin
Process.waitall
rescue Interrupt
# CTRL-C, shut down cleanly (sans stack trace)
end

when "add", "init"
repo = Bananajour.add!(ARGV[1] || File.expand_path("."))
Expand Down
10 changes: 8 additions & 2 deletions lib/bananajour/bonjour/advertiser.rb
Expand Up @@ -20,10 +20,16 @@ def register_app
DNSSD.register("#{Bananajour.config.name}'s bananajour", "_http._tcp,_bananajour", nil, Bananajour.web_port, tr)
end
def register_repos
loop do
interrupted = false
while !interrupted
stop_old_services
register_new_repositories
sleep(1)
begin
sleep(1)
rescue Interrupt
# CTRL-C, shut down cleanly (sans stack trace)
interrupted = true
end
end
end
def stop_old_services
Expand Down

0 comments on commit 628bc0b

Please sign in to comment.