Skip to content
Permalink
Browse files

Return 22 when both -s and -c options used

- before, 1 was retured incorrectly
- now, settings.ReturnValues.INVALID_CLI_OPTION (22) is returned
Resolves #334
  • Loading branch information...
bocekm committed Oct 26, 2017
1 parent 6b5aac0 commit 8c7057f5fe06944a26419a309c0b92248a1ad632
Showing with 7 additions and 4 deletions.
  1. +7 −4 bin/preupg
@@ -2,6 +2,7 @@
# -*- coding: utf-8 -*-


from optparse import OptionValueError
import sys
import traceback
from preupg.cli import CLI
@@ -12,21 +13,23 @@ from preupg.logger import logger_debug


def main():
cli = CLI()
conf = Conf(cli.opts, settings, cli)
app = Application(conf)
try:
cli = CLI()
conf = Conf(cli.opts, settings, cli)
app = Application(conf)
return_code = app.run()
logger_debug.debug("preupg returned '%s'" % return_code)
return return_code
except KeyboardInterrupt:
sys.stderr.write("\nAssessment interrupted.\n")
return settings.ReturnValues.USER_ABORT
except Exception as ex:
if cli.opts.debug:
if 'cli' in locals() and cli.opts.debug:
traceback.print_exc(file=sys.stderr)
else:
sys.stderr.write(str(ex) + "\n")
if isinstance(ex, OptionValueError):
return settings.ReturnValues.INVALID_CLI_OPTION
return settings.ReturnValues.INTERNAL_EXCEPTION


0 comments on commit 8c7057f

Please sign in to comment.
You can’t perform that action at this time.