From 4f9be7134d28ef78780c284dbad3d1cc5aa22047 Mon Sep 17 00:00:00 2001 From: evilsocket Date: Wed, 10 Aug 2016 18:50:35 -0700 Subject: [PATCH] Fixes #254: Exception on CTRL+C --- bin/bettercap | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) 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