OLD | NEW |
1 # Copyright (c) 2009, Google Inc. All rights reserved. | 1 # Copyright (c) 2009, Google Inc. All rights reserved. |
2 # Copyright (c) 2009 Apple Inc. All rights reserved. | 2 # Copyright (c) 2009 Apple Inc. All rights reserved. |
3 # | 3 # |
4 # Redistribution and use in source and binary forms, with or without | 4 # Redistribution and use in source and binary forms, with or without |
5 # modification, are permitted provided that the following conditions are | 5 # modification, are permitted provided that the following conditions are |
6 # met: | 6 # met: |
7 # | 7 # |
8 # * Redistributions of source code must retain the above copyright | 8 # * Redistributions of source code must retain the above copyright |
9 # notice, this list of conditions and the following disclaimer. | 9 # notice, this list of conditions and the following disclaimer. |
10 # * Redistributions in binary form must reproduce the above | 10 # * Redistributions in binary form must reproduce the above |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 message = 'Failed to run "%s"' % repr(script_args) | 62 message = 'Failed to run "%s"' % repr(script_args) |
63 if exit_code: | 63 if exit_code: |
64 message += " exit_code: %d" % exit_code | 64 message += " exit_code: %d" % exit_code |
65 if cwd: | 65 if cwd: |
66 message += " cwd: %s" % cwd | 66 message += " cwd: %s" % cwd |
67 | 67 |
68 if shortened_output: | 68 if shortened_output: |
69 message += "\n\noutput: %s" % shortened_output | 69 message += "\n\noutput: %s" % shortened_output |
70 | 70 |
71 Exception.__init__(self, message) | 71 Exception.__init__(self, message) |
72 self.script_args = script_args # 'args' is already used by Exception | 72 self.script_args = script_args # 'args' is already used by Exception |
73 self.exit_code = exit_code | 73 self.exit_code = exit_code |
74 self.output = output | 74 self.output = output |
75 self.cwd = cwd | 75 self.cwd = cwd |
76 | 76 |
77 def message_with_output(self): | 77 def message_with_output(self): |
78 return unicode(self) | 78 return unicode(self) |
79 | 79 |
80 def command_name(self): | 80 def command_name(self): |
81 command_path = self.script_args | 81 command_path = self.script_args |
82 if type(command_path) is list: | 82 if type(command_path) is list: |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
478 pool.close() | 478 pool.close() |
479 pool.join() | 479 pool.join() |
480 | 480 |
481 | 481 |
482 def _run_command_thunk(cmd_line_and_cwd): | 482 def _run_command_thunk(cmd_line_and_cwd): |
483 # Note that this needs to be a bare module (and hence Picklable) method to w
ork with multiprocessing.Pool. | 483 # Note that this needs to be a bare module (and hence Picklable) method to w
ork with multiprocessing.Pool. |
484 (cmd_line, cwd) = cmd_line_and_cwd | 484 (cmd_line, cwd) = cmd_line_and_cwd |
485 proc = subprocess.Popen(cmd_line, cwd=cwd, stdout=subprocess.PIPE, stderr=su
bprocess.PIPE) | 485 proc = subprocess.Popen(cmd_line, cwd=cwd, stdout=subprocess.PIPE, stderr=su
bprocess.PIPE) |
486 stdout, stderr = proc.communicate() | 486 stdout, stderr = proc.communicate() |
487 return (proc.returncode, stdout, stderr) | 487 return (proc.returncode, stdout, stderr) |
OLD | NEW |