зеркало из https://github.com/mozilla/gecko-dev.git
Bug 892902 - [mozprocess] Returncode for kill() on Windows has to be set from wait(). r=ahal
Currently the returncode gets set immediately after the process has been terminated via TerminateJobObject() or TerminateProcess(). Given that in both cases the process has not been quit yet, but still waits for all streams to be closed, the returncode has to be set by via wait(). Also in case of TerminateJobObject() the _cleanup method is never called if an exception occurs. MozReview-Commit-ID: 4NEyqafN0DD --HG-- extra : rebase_source : ae176d5e052785cc77865e1bf220013e87d7a3f0
This commit is contained in:
Родитель
a426ad7cda
Коммит
111c06a7ca
|
@ -139,20 +139,19 @@ class ProcessHandlerMixin(object):
|
|||
|
||||
def kill(self, sig=None):
|
||||
if isWin:
|
||||
try:
|
||||
if not self._ignore_children and self._handle and self._job:
|
||||
self.debug("calling TerminateJobObject")
|
||||
winprocess.TerminateJobObject(self._job, winprocess.ERROR_CONTROL_C_EXIT)
|
||||
self.returncode = winprocess.GetExitCodeProcess(self._handle)
|
||||
elif self._handle:
|
||||
self.debug("calling TerminateProcess")
|
||||
try:
|
||||
winprocess.TerminateProcess(self._handle, winprocess.ERROR_CONTROL_C_EXIT)
|
||||
except Exception:
|
||||
except WindowsError:
|
||||
self._cleanup()
|
||||
|
||||
traceback.print_exc()
|
||||
raise OSError("Could not terminate process")
|
||||
finally:
|
||||
winprocess.GetExitCodeProcess(self._handle)
|
||||
self._cleanup()
|
||||
|
||||
else:
|
||||
def send_sig(sig, retries=0):
|
||||
pid = self.detached_pid or self.pid
|
||||
|
|
Загрузка…
Ссылка в новой задаче