| 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 def command_name(self): | 79 def command_name(self): |
| 80 command_path = self.script_args | 80 command_path = self.script_args |
| 81 if type(command_path) is list: | 81 if type(command_path) is list: |
| 82 command_path = command_path[0] | 82 command_path = command_path[0] |
| 83 return os.path.basename(command_path) | 83 return os.path.basename(command_path) |
| 84 | 84 |
| 85 | 85 |
| 86 class Executive(object): | 86 class Executive(object): |
| 87 PIPE = subprocess.PIPE | 87 PIPE = subprocess.PIPE |
| 88 STDOUT = subprocess.STDOUT | 88 STDOUT = subprocess.STDOUT |
| 89 DEVNULL = open(os.devnull, 'wb') |
| 89 | 90 |
| 90 def _should_close_fds(self): | 91 def _should_close_fds(self): |
| 91 # We need to pass close_fds=True to work around Python bug #2320 | 92 # We need to pass close_fds=True to work around Python bug #2320 |
| 92 # (otherwise we can hang when we kill DumpRenderTree when we are running | 93 # (otherwise we can hang when we kill DumpRenderTree when we are running |
| 93 # multiple threads). See http://bugs.python.org/issue2320 . | 94 # multiple threads). See http://bugs.python.org/issue2320 . |
| 94 # Note that close_fds isn't supported on Windows, but this bug only | 95 # Note that close_fds isn't supported on Windows, but this bug only |
| 95 # shows up on Mac and Linux. | 96 # shows up on Mac and Linux. |
| 96 return sys.platform not in ('win32', 'cygwin') | 97 return sys.platform not in ('win32', 'cygwin') |
| 97 | 98 |
| 98 def _run_command_with_teed_output(self, args, teed_output, **kwargs): | 99 def _run_command_with_teed_output(self, args, teed_output, **kwargs): |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 pool.close() | 454 pool.close() |
| 454 pool.join() | 455 pool.join() |
| 455 | 456 |
| 456 | 457 |
| 457 def _run_command_thunk(cmd_line_and_cwd): | 458 def _run_command_thunk(cmd_line_and_cwd): |
| 458 # Note that this needs to be a bare module (and hence Picklable) method to w
ork with multiprocessing.Pool. | 459 # Note that this needs to be a bare module (and hence Picklable) method to w
ork with multiprocessing.Pool. |
| 459 (cmd_line, cwd) = cmd_line_and_cwd | 460 (cmd_line, cwd) = cmd_line_and_cwd |
| 460 proc = subprocess.Popen(cmd_line, cwd=cwd, stdout=subprocess.PIPE, stderr=su
bprocess.PIPE) | 461 proc = subprocess.Popen(cmd_line, cwd=cwd, stdout=subprocess.PIPE, stderr=su
bprocess.PIPE) |
| 461 stdout, stderr = proc.communicate() | 462 stdout, stderr = proc.communicate() |
| 462 return (proc.returncode, stdout, stderr) | 463 return (proc.returncode, stdout, stderr) |
| OLD | NEW |