Skip to content

Commit

Permalink
client: adjust exception logging
Browse files Browse the repository at this point in the history
When running autoptsclient-zephyr.py --help, traceback was printed
in terminal. This was caused by logging.exception(e) which should not
be called when exiting with status 0.
  • Loading branch information
piotrnarajowski committed Nov 14, 2024
1 parent 06d7c00 commit 92f8c82
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions autopts/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1361,9 +1361,12 @@ def sigint_handler(sig, frame):
signal.signal(signal.SIGINT, sigint_handler)

return self.main(args)
except BaseException as e: # Ctrl-C
if not isinstance(e, KeyboardInterrupt):
logging.exception(e)
except BaseException as e:
if not isinstance(e, KeyboardInterrupt): # Ctrl-C
if e.code != 0:
# Exit with traceback
logging.exception(e)

set_global_end()
self.cleanup()
raise
Expand Down

0 comments on commit 92f8c82

Please sign in to comment.