Skip to content

Commit

Permalink
Changed option to take an int as an argument
Browse files Browse the repository at this point in the history
  • Loading branch information
Stateford authored and cgoldberg committed Apr 29, 2019
1 parent a3f96a2 commit a54bff7
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions locust/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,12 +282,14 @@ def parse_options():
help="show program's version number and exit"
)

# set the exit code to post on errors
parser.add_option(
'--exit-code-on-fail',
action='store_false',
dest='exit_code_on_fail',
default=True,
help="post exit code 1 on error"
'--exit-code-on-error',
action='store',
type="int",
dest='exit_code_on_error',
default=1,
help="sets the exit code to post on error"
)

# Finalize
Expand Down Expand Up @@ -561,8 +563,8 @@ def sig_term_handler():
logger.info("Starting Locust %s" % version)
main_greenlet.join()
code = 0
if len(runners.locust_runner.errors) and options.exit_code_on_fail:
code = 1
if len(runners.locust_runner.errors):
code = options.exit_code_on_error
shutdown(code=code)
except KeyboardInterrupt as e:
shutdown(0)
Expand Down

0 comments on commit a54bff7

Please sign in to comment.