| OLD | NEW |
| 1 # Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """Generic utils.""" | 5 """Generic utils.""" |
| 6 | 6 |
| 7 import errno | 7 import errno |
| 8 import logging | 8 import logging |
| 9 import os | 9 import os |
| 10 import Queue | 10 import Queue |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 | 25 |
| 26 | 26 |
| 27 class Error(Exception): | 27 class Error(Exception): |
| 28 """gclient exception class.""" | 28 """gclient exception class.""" |
| 29 pass | 29 pass |
| 30 | 30 |
| 31 | 31 |
| 32 class CheckCallError(OSError, Error): | 32 class CheckCallError(OSError, Error): |
| 33 """CheckCall() returned non-0.""" | 33 """CheckCall() returned non-0.""" |
| 34 def __init__(self, command, cwd, returncode, stdout, stderr=None): | 34 def __init__(self, command, cwd, returncode, stdout, stderr=None): |
| 35 OSError.__init__(self, command, cwd, returncode, stdout, stderr) | 35 OSError.__init__(self, command, cwd, returncode) |
| 36 Error.__init__(self, command) | 36 Error.__init__(self, command) |
| 37 self.command = command | 37 self.command = command |
| 38 self.cwd = cwd | 38 self.cwd = cwd |
| 39 self.returncode = returncode | 39 self.returncode = returncode |
| 40 self.stdout = stdout | 40 self.stdout = stdout |
| 41 self.stderr = stderr | 41 self.stderr = stderr |
| 42 | 42 |
| 43 def __str__(self): | 43 def __str__(self): |
| 44 out = ' '.join(self.command) | 44 out = ' '.join(self.command) |
| 45 if self.cwd: | 45 if self.cwd: |
| (...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 678 logging.info('Caught exception in thread %s' % self.item.name) | 678 logging.info('Caught exception in thread %s' % self.item.name) |
| 679 logging.info(str(sys.exc_info())) | 679 logging.info(str(sys.exc_info())) |
| 680 work_queue.exceptions.put(sys.exc_info()) | 680 work_queue.exceptions.put(sys.exc_info()) |
| 681 logging.info('Task %s done' % self.item.name) | 681 logging.info('Task %s done' % self.item.name) |
| 682 | 682 |
| 683 work_queue.ready_cond.acquire() | 683 work_queue.ready_cond.acquire() |
| 684 try: | 684 try: |
| 685 work_queue.ready_cond.notifyAll() | 685 work_queue.ready_cond.notifyAll() |
| 686 finally: | 686 finally: |
| 687 work_queue.ready_cond.release() | 687 work_queue.ready_cond.release() |
| OLD | NEW |