Skip to content

Commit

Permalink
Merge pull request #155 from jpotter/master
Browse files Browse the repository at this point in the history
Exit with return code 1 when errors are found
  • Loading branch information
heyman committed May 12, 2014
2 parents 64d3188 + 0c744a2 commit 5c9c0b4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 5 additions & 2 deletions locust/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ def shutdown(code=0):
"""
Shut down locust by firing quitting event, printing stats and exiting
"""
logger.info("Shutting down, bye..")
logger.info("Shutting down (exit code %s), bye." % code)

events.quitting.fire()
print_stats(runners.locust_runner.request_stats)
Expand All @@ -439,7 +439,10 @@ def sig_term_handler():
try:
logger.info("Starting Locust %s" % version)
main_greenlet.join()
shutdown(0)
code = 0
if len(runners.locust_runner.errors):
code = 1
shutdown(code=code)
except KeyboardInterrupt as e:
shutdown(0)

Expand Down
2 changes: 2 additions & 0 deletions locust/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,8 @@ def print_percentile_stats(stats):
console_logger.info("")

def print_error_report():
if not len(global_stats.errors):
return
console_logger.info("Error report")
console_logger.info(" %-18s %-100s" % ("# occurences", "Error"))
console_logger.info("-" * (80 + STATS_NAME_WIDTH))
Expand Down

0 comments on commit 5c9c0b4

Please sign in to comment.