diff --git a/bin/bettercap b/bin/bettercap index 3846bb11..f6c58b15 100755 --- a/bin/bettercap +++ b/bin/bettercap @@ -57,8 +57,15 @@ rescue Exception => e BetterCap::Logger.error "Backtrace :\n\n #{e.backtrace.join("\n ")}\n" ensure + # handle double ctrl+c nicely + trap("INT") { } + # Make sure all the messages on the logger queue are printed. - BetterCap::Logger.wait! + begin + BetterCap::Logger.wait! + rescue; end - ctx.finalize unless ctx.nil? + begin + ctx.finalize unless ctx.nil? + rescue; end end