diff options
author | Samuel Merritt <spam@andcheese.org> | 2012-06-07 12:14:06 -0700 |
---|---|---|
committer | Samuel Merritt <spam@andcheese.org> | 2012-06-07 12:17:51 -0700 |
commit | 6119de7e0b92739549a5ce52142c9bc78dd9e589 (patch) | |
tree | 5c0d8b80c2a3dc4605d9ae45bf13a0d3eb9f4f3a | |
parent | dec11f6ec913e6874668c67e5643b81e0014f723 (diff) | |
download | python-swiftclient-6119de7e0b92739549a5ce52142c9bc78dd9e589.tar.gz |
Make CLI exit nonzero on error.
This makes it much easier to detect failure in scripts.
Fixes bug 973557.
Change-Id: Ifd16ffcb7be85e45582095246cc29cfe44e2a173
-rwxr-xr-x | bin/swift | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -1035,9 +1035,12 @@ Example: print_thread = QueueFunctionThread(print_queue, _print) print_thread.start() + error_count = 0 error_queue = Queue(10000) def _error(item): + global error_count + error_count += 1 if isinstance(item, unicode): item = item.encode('utf8') print >> stderr, item @@ -1062,6 +1065,8 @@ Example: error_thread.abort = True while error_thread.isAlive(): error_thread.join(0.01) + if error_count: + exit(1) except (SystemExit, Exception): for thread in threading_enumerate(): thread.abort = True |