Skip to content

Commit

Permalink
argdist: Exit with nonzero return code on error
Browse files Browse the repository at this point in the history
  • Loading branch information
goldshtn committed Feb 13, 2017
1 parent d11179d commit f7ab443
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions tools/argdist.py
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,7 @@ def _create_probes(self):
self.probes.append(Probe(self, "hist", histspecifier))
if len(self.probes) == 0:
print("at least one specifier is required")
exit()
exit(1)

def _generate_program(self):
bpf_source = """
Expand Down Expand Up @@ -695,10 +695,13 @@ def run(self):
self._attach()
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 f7ab443

Please sign in to comment.