From 7741c72de28a339b3e1ab8a84eb062c874a73c45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fatih=20A=C5=9F=C4=B1c=C4=B1?= Date: Sat, 27 Feb 2010 22:09:06 +0000 Subject: [PATCH] Better --- pisi-cli | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pisi-cli b/pisi-cli index 6c25de16..c9fc7286 100755 --- a/pisi-cli +++ b/pisi-cli @@ -37,6 +37,7 @@ def handle_exception(exception, value, tb): signal.signal(signal.SIGINT, signal.SIG_IGN) # disable further interrupts ui = pisi.cli.CLI() # make a temporary UI show_traceback = False + if exception == exceptions.KeyboardInterrupt: ui.error(_("Keyboard Interrupt: Exiting...")) exit() @@ -53,15 +54,15 @@ def handle_exception(exception, value, tb): show_traceback = ctx.get_option('debug') ui.error(_("System error. Program terminated.")) - if ctx.get_option('debug'): - ui.error(u"%s: %s" % (exception, str(value))) + if show_traceback: + ui.error("%s: %s" % (exception, str(value))) else: ui.error(str(value)) - ui.info(_("\nPlease use 'pisi help' for general help.")) + ui.info(_("Please use 'pisi help' for general help.")) if show_traceback: - ui.info(_("Traceback:")) + ui.info(_("\nTraceback:")) traceback.print_tb(tb) else: if not exception is pisi.Error: @@ -70,7 +71,6 @@ def handle_exception(exception, value, tb): exit() if __name__ == "__main__": - sys.excepthook = handle_exception signal.signal(signal.SIGTERM, sig_handler)