diff options
author | Simon Warta <[email protected]> | 2015-07-12 13:05:23 +0200 |
---|---|---|
committer | Simon Warta <[email protected]> | 2015-07-12 13:09:39 +0200 |
commit | 7979010cc19644a028a88ca49d5dc77b09bf2171 (patch) | |
tree | 68328219e573cee6dca03eee92a3a3fa0a22ad43 | |
parent | 12e884924f9d620e0f3cce632b0f9b71a721b4d1 (diff) |
Exit configure script with return value 1 on error
-rwxr-xr-x | configure.py | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/configure.py b/configure.py index fb5a8e3bd..44871e381 100755 --- a/configure.py +++ b/configure.py @@ -4,6 +4,7 @@ Configuration program for botan (C) 2009,2010,2011,2012,2013,2014,2015 Jack Lloyd +(C) 2015 Simon Warta (Kullo GmbH) Botan is released under the Simplified BSD License (see license.txt) @@ -1764,8 +1765,17 @@ def main(argv = None): if argv is None: argv = sys.argv - logging.basicConfig(stream = sys.stdout, - format = '%(levelname) 7s: %(message)s') + class BotanConfigureLogHandler(logging.StreamHandler): + def emit(self, record): + # Do the default stuff first + super(BotanConfigureLogHandler, self).emit(record) + # Exit script if and ERROR or worse occurred + if record.levelno >= logging.ERROR: + sys.exit(1) + + lh = BotanConfigureLogHandler(stream = sys.stdout) + lh.setFormatter(logging.Formatter('%(levelname) 7s: %(message)s')) + logging.getLogger().addHandler(lh) options = process_command_line(argv[1:]) @@ -1987,8 +1997,7 @@ if __name__ == '__main__': try: main() except Exception as e: - logging.error(e) import traceback logging.debug(traceback.format_exc()) - sys.exit(1) + logging.error(e) sys.exit(0) |