diff options
| author | Lex Neva <github.com@lexneva.name> | 2018-04-18 16:12:42 -0400 |
|---|---|---|
| committer | Lex Neva <github.com@lexneva.name> | 2018-04-18 16:13:51 -0400 |
| commit | 9148d5484462e342ab716a7b4b0859c7c298702a (patch) | |
| tree | 4a62b1c0cbc3bb21ad4e4cff13649d2c2e63aafd | |
| parent | a5900865c76b4b65c712ef6d39fda9eaae2c5007 (diff) | |
hide stderr but print exceptions
| -rw-r--r-- | embroider_print.py | 19 |
1 files 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) |
