diff --git a/pubs/pubs b/pubs/pubs index de96fe2..7699f18 100755 --- a/pubs/pubs +++ b/pubs/pubs @@ -1,19 +1,7 @@ #!/usr/bin/env python # -*- coding:utf-8 -*- -import sys - from pubs import pubs_cmd -try: - pubs_cmd.execute() -except BrokenPipeError: - # stdout or stderr has been closed, cleaning up - try: - sys.stdout.close() - except IOError: - pass - try: - sys.stderr.close() - except IOError: - pass + +pubs_cmd.execute() diff --git a/pubs/pubs_cmd.py b/pubs/pubs_cmd.py index c443f26..5b93893 100644 --- a/pubs/pubs_cmd.py +++ b/pubs/pubs_cmd.py @@ -84,4 +84,5 @@ def execute(raw_args=sys.argv): args.func(conf, args) except Exception as e: - uis.get_ui().handle_exception(e) + if not uis.get_ui().handle_exception(e): + raise diff --git a/pubs/uis.py b/pubs/uis.py index 7298e77..dfb5cd6 100644 --- a/pubs/uis.py +++ b/pubs/uis.py @@ -84,11 +84,14 @@ class PrintUI(object): sys.exit(error_code) def handle_exception(self, exc): - if self.debug: - raise - else: + """Attempts to handle exception. + + :returns: True if exception has been handled (currently never happens) + """ + if not self.debug: self.error(ustr(exc)) self.exit() + return False class InputUI(PrintUI):