Skip to content

Commit

Permalink
Merge "Make CLI exit nonzero on error."
Browse files Browse the repository at this point in the history
  • Loading branch information
Jenkins authored and openstack-gerrit committed Jun 27, 2012
2 parents 8396e3a + 6119de7 commit 2e05673
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions bin/swift
Expand Up @@ -1041,9 +1041,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
Expand All @@ -1068,6 +1071,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
Expand Down

0 comments on commit 2e05673

Please sign in to comment.