Skip to content

Commit

Permalink
trace: Exit with nonzero return code on error
Browse files Browse the repository at this point in the history
  • Loading branch information
goldshtn committed Mar 11, 2017
1 parent f7ab443 commit 2febc29
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tools/trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -691,10 +691,13 @@ def run(self):
self._attach_probes()
self._main_loop()
except:
exc_info = sys.exc_info()
sys_exit = exc_info[0] is SystemExit
if self.args.verbose:
traceback.print_exc()
elif sys.exc_info()[0] is not SystemExit:
print(sys.exc_info()[1])
elif not sys_exit:
print(exc_info[1])
exit(0 if sys_exit else 1)

if __name__ == "__main__":
Tool().run()

0 comments on commit 2febc29

Please sign in to comment.