| 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 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 def _windows_image_name(self, process_name): | 285 def _windows_image_name(self, process_name): |
| 286 name, extension = os.path.splitext(process_name) | 286 name, extension = os.path.splitext(process_name) |
| 287 if not extension: | 287 if not extension: |
| 288 # taskkill expects processes to end in .exe | 288 # taskkill expects processes to end in .exe |
| 289 # If necessary we could add a flag to disable appending .exe. | 289 # If necessary we could add a flag to disable appending .exe. |
| 290 process_name = "%s.exe" % name | 290 process_name = "%s.exe" % name |
| 291 return process_name | 291 return process_name |
| 292 | 292 |
| 293 def interrupt(self, pid): | 293 def interrupt(self, pid): |
| 294 interrupt_signal = signal.SIGINT | 294 interrupt_signal = signal.SIGINT |
| 295 # FIXME: The python docs seem to imply that platform == 'win32' may need
to use signal.CTRL_C_EVENT | 295 # Note: The python docs seem to suggest that on Windows, we may want to
use |
| 296 # http://docs.python.org/2/library/signal.html | 296 # signal.CTRL_C_EVENT (http://docs.python.org/2/library/signal.html), bu
t |
| 297 # it appears that signal.SIGINT also appears to work on Windows. |
| 297 try: | 298 try: |
| 298 os.kill(pid, interrupt_signal) | 299 os.kill(pid, interrupt_signal) |
| 299 except OSError: | 300 except OSError: |
| 300 # Silently ignore when the pid doesn't exist. | 301 # Silently ignore when the pid doesn't exist. |
| 301 # It's impossible for callers to avoid race conditions with process
shutdown. | 302 # It's impossible for callers to avoid race conditions with process
shutdown. |
| 302 pass | 303 pass |
| 303 | 304 |
| 304 # Error handlers do not need to be static methods once all callers are | 305 # Error handlers do not need to be static methods once all callers are |
| 305 # updated to use an Executive object. | 306 # updated to use an Executive object. |
| 306 | 307 |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 468 pool.close() | 469 pool.close() |
| 469 pool.join() | 470 pool.join() |
| 470 | 471 |
| 471 | 472 |
| 472 def _run_command_thunk(cmd_line_and_cwd): | 473 def _run_command_thunk(cmd_line_and_cwd): |
| 473 # Note that this needs to be a bare module (and hence Picklable) method to w
ork with multiprocessing.Pool. | 474 # Note that this needs to be a bare module (and hence Picklable) method to w
ork with multiprocessing.Pool. |
| 474 (cmd_line, cwd) = cmd_line_and_cwd | 475 (cmd_line, cwd) = cmd_line_and_cwd |
| 475 proc = subprocess.Popen(cmd_line, cwd=cwd, stdout=subprocess.PIPE, stderr=su
bprocess.PIPE) | 476 proc = subprocess.Popen(cmd_line, cwd=cwd, stdout=subprocess.PIPE, stderr=su
bprocess.PIPE) |
| 476 stdout, stderr = proc.communicate() | 477 stdout, stderr = proc.communicate() |
| 477 return (proc.returncode, stdout, stderr) | 478 return (proc.returncode, stdout, stderr) |
| OLD | NEW |