Skip to content

Commit

Permalink
Merge pull request lukeredpath#5 from incandescent/fix-interrupt-hand…
Browse files Browse the repository at this point in the history
…ling

fix interrupt handling
  • Loading branch information
lukeredpath committed Mar 9, 2012
2 parents de5ea74 + 75766d7 commit b7c48ae
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/mimic.rb
Expand Up @@ -67,8 +67,13 @@ def start_service(app, options)
}) do |server|
@server = server

old = trap('EXIT') do
old.call if old
@previous_int_handler = trap('INT') do
begin
# support case of default command String names
@previous_int_handler.call if @previous_int_handler and @previous_int_handler.respond_to?("call")
rescue StandardError => e
puts "Error occurred invoking previous interrupt handler: #{e.class} #{e.to_s}"
end
@server.shutdown
end
end
Expand Down

0 comments on commit b7c48ae

Please sign in to comment.