| 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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 if pe32.th32ProcessID == pid: | 198 if pe32.th32ProcessID == pid: |
| 199 result = True | 199 result = True |
| 200 break | 200 break |
| 201 if not Process32Next(hProcessSnap, ctypes.byref(pe32)): | 201 if not Process32Next(hProcessSnap, ctypes.byref(pe32)): |
| 202 break | 202 break |
| 203 CloseHandle(hProcessSnap) | 203 CloseHandle(hProcessSnap) |
| 204 return result | 204 return result |
| 205 | 205 |
| 206 def check_running_pid(self, pid): | 206 def check_running_pid(self, pid): |
| 207 """Return True if pid is alive, otherwise return False.""" | 207 """Return True if pid is alive, otherwise return False.""" |
| 208 _log.debug('Checking whether pid %d is alive.', pid) |
| 208 if sys.platform == 'win32': | 209 if sys.platform == 'win32': |
| 209 return self._win32_check_running_pid(pid) | 210 return self._win32_check_running_pid(pid) |
| 210 | 211 |
| 211 try: | 212 try: |
| 212 os.kill(pid, 0) | 213 os.kill(pid, 0) |
| 213 return True | 214 return True |
| 214 except OSError: | 215 except OSError: |
| 215 return False | 216 return False |
| 216 | 217 |
| 217 def _running_processes(self): | 218 def _running_processes(self): |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 pool.close() | 470 pool.close() |
| 470 pool.join() | 471 pool.join() |
| 471 | 472 |
| 472 | 473 |
| 473 def _run_command_thunk(cmd_line_and_cwd): | 474 def _run_command_thunk(cmd_line_and_cwd): |
| 474 # Note that this needs to be a bare module (and hence Picklable) method to w
ork with multiprocessing.Pool. | 475 # Note that this needs to be a bare module (and hence Picklable) method to w
ork with multiprocessing.Pool. |
| 475 (cmd_line, cwd) = cmd_line_and_cwd | 476 (cmd_line, cwd) = cmd_line_and_cwd |
| 476 proc = subprocess.Popen(cmd_line, cwd=cwd, stdout=subprocess.PIPE, stderr=su
bprocess.PIPE) | 477 proc = subprocess.Popen(cmd_line, cwd=cwd, stdout=subprocess.PIPE, stderr=su
bprocess.PIPE) |
| 477 stdout, stderr = proc.communicate() | 478 stdout, stderr = proc.communicate() |
| 478 return (proc.returncode, stdout, stderr) | 479 return (proc.returncode, stdout, stderr) |
| OLD | NEW |