| OLD | NEW |
| 1 # Copyright 2009 Google Inc. All Rights Reserved. | 1 # Copyright 2009 Google Inc. All Rights Reserved. |
| 2 # | 2 # |
| 3 # Licensed under the Apache License, Version 2.0 (the "License"); | 3 # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 # you may not use this file except in compliance with the License. | 4 # you may not use this file except in compliance with the License. |
| 5 # You may obtain a copy of the License at | 5 # You may obtain a copy of the License at |
| 6 # | 6 # |
| 7 # http://www.apache.org/licenses/LICENSE-2.0 | 7 # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 # | 8 # |
| 9 # Unless required by applicable law or agreed to in writing, software | 9 # Unless required by applicable law or agreed to in writing, software |
| 10 # distributed under the License is distributed on an "AS IS" BASIS, | 10 # distributed under the License is distributed on an "AS IS" BASIS, |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 if filter_fn: | 310 if filter_fn: |
| 311 filter_fn(in_line) | 311 filter_fn(in_line) |
| 312 in_line = '' | 312 in_line = '' |
| 313 # Flush at least 10 seconds between line writes. We wait at least 10 | 313 # Flush at least 10 seconds between line writes. We wait at least 10 |
| 314 # seconds to avoid overloading the reader that called us with output, | 314 # seconds to avoid overloading the reader that called us with output, |
| 315 # which can slow busy readers down. | 315 # which can slow busy readers down. |
| 316 if (time.time() - last_flushed_at) > 10: | 316 if (time.time() - last_flushed_at) > 10: |
| 317 last_flushed_at = time.time() | 317 last_flushed_at = time.time() |
| 318 sys.stdout.flush() | 318 sys.stdout.flush() |
| 319 in_byte = kid.stdout.read(1) | 319 in_byte = kid.stdout.read(1) |
| 320 # Flush the rest of buffered output. This is only an issue with files not |
| 321 # ending with a \n. |
| 322 if len(in_line) and filter_fn: |
| 323 filter_fn(in_line) |
| 320 rv = kid.wait() | 324 rv = kid.wait() |
| 321 | 325 |
| 322 if rv: | 326 if rv: |
| 323 msg = 'failed to run command: %s' % ' '.join(command) | 327 msg = 'failed to run command: %s' % ' '.join(command) |
| 324 | 328 |
| 325 if fail_status != None: | 329 if fail_status != None: |
| 326 print >>sys.stderr, msg | 330 print >>sys.stderr, msg |
| 327 sys.exit(fail_status) | 331 sys.exit(fail_status) |
| 328 | 332 |
| 329 raise Error(msg) | 333 raise Error(msg) |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 520 if exception: | 524 if exception: |
| 521 self.parent.exceptions.append(exception) | 525 self.parent.exceptions.append(exception) |
| 522 if self.parent.progress: | 526 if self.parent.progress: |
| 523 self.parent.progress.update(1) | 527 self.parent.progress.update(1) |
| 524 assert not self.item.name in self.parent.ran | 528 assert not self.item.name in self.parent.ran |
| 525 if not self.item.name in self.parent.ran: | 529 if not self.item.name in self.parent.ran: |
| 526 self.parent.ran.append(self.item.name) | 530 self.parent.ran.append(self.item.name) |
| 527 finally: | 531 finally: |
| 528 self.parent.ready_cond.notifyAll() | 532 self.parent.ready_cond.notifyAll() |
| 529 self.parent.ready_cond.release() | 533 self.parent.ready_cond.release() |
| OLD | NEW |