From 9148d5484462e342ab716a7b4b0859c7c298702a Mon Sep 17 00:00:00 2001 From: Lex Neva Date: Wed, 18 Apr 2018 16:12:42 -0400 Subject: hide stderr but print exceptions --- embroider_print.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/embroider_print.py b/embroider_print.py index 2aa76ec6..0dbff929 100644 --- a/embroider_print.py +++ b/embroider_print.py @@ -363,7 +363,18 @@ class Print(InkstitchExtension): if __name__ == '__main__': - #save_stderr() - effect = Print() - effect.affect() - #restore_stderr() + exception = None + + save_stderr() + try: + effect = Print() + effect.affect() + except: + exception = traceback.format_exc() + restore_stderr() + + if exception: + print >> sys.stderr, exception + sys.exit(1) + else: + sys.exit(0) -- cgit v1.2.3