summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorSamuel Merritt <spam@andcheese.org>2012-06-07 12:14:06 -0700
committerSamuel Merritt <spam@andcheese.org>2012-06-07 12:17:51 -0700
commit6119de7e0b92739549a5ce52142c9bc78dd9e589 (patch)
tree5c0d8b80c2a3dc4605d9ae45bf13a0d3eb9f4f3a /bin
parentdec11f6ec913e6874668c67e5643b81e0014f723 (diff)
downloadpython-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
Diffstat (limited to 'bin')
-rwxr-xr-xbin/swift5
1 files changed, 5 insertions, 0 deletions
diff --git a/bin/swift b/bin/swift
index 354f82c..b578360 100755
--- a/bin/swift
+++ b/bin/swift
@@ -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