PATCH: Improve Windows file-not-found failure mode
Mark Mitchell
mark at codesourcery.com
Wed Feb 18 11:05:14 UTC 2004
When the file invoked by TimeoutExecutable did not exist, we got an
additional fault on Windows: the __monitor_thread had not been created
yet, and so we got an exception tried to join it.
Applied on the 2.1 branch and on the mainline.
--
Mark Mitchell
CodeSourcery, LLC
mark at codesourcery.com
2004-02-18 Mark Mitchell <mark at codesourcery.com>
* qm/executable.py (TimeoutExecutable.Run): Handle failure to
locate the executable file robustly under Windows.
Index: qm/executable.py
===================================================================
RCS file: /home/qm/Repository/qm/qm/executable.py,v
retrieving revision 1.22
diff -c -5 -p -r1.22 executable.py
*** qm/executable.py 24 Nov 2003 23:00:54 -0000 1.22
--- qm/executable.py 18 Feb 2004 11:00:03 -0000
*************** class TimeoutExecutable(Executable):
*** 498,521 ****
def Run(self, arguments=[], environment = None, dir = None,
path = None):
# Run the process.
try:
status = super(TimeoutExecutable, self).Run(arguments,
environment,
dir,
path)
finally:
if self.__UseSeparateProcessGroupForChild():
# Clean up the monitoring program; it is no longer needed.
os.kill(-self._GetChildPID(), signal.SIGKILL)
! os.waitpid(self.__monitor_pid, 0)
elif self.__timeout >= 0 and sys.platform == "win32":
# Join the monitoring thread.
! self.__monitor_thread.join()
return status
def __UseSeparateProcessGroupForChild(self):
--- 498,528 ----
def Run(self, arguments=[], environment = None, dir = None,
path = None):
+ if self.__UseSeparateProcessGroupForChild():
+ self.__monitor_pid = None
+ elif self.__timeout >= 0 and sys.platform == "win32":
+ self.__monitor_thread = None
+
# Run the process.
try:
status = super(TimeoutExecutable, self).Run(arguments,
environment,
dir,
path)
finally:
if self.__UseSeparateProcessGroupForChild():
# Clean up the monitoring program; it is no longer needed.
os.kill(-self._GetChildPID(), signal.SIGKILL)
! if self.__monitor_pid is not None:
! os.waitpid(self.__monitor_pid, 0)
elif self.__timeout >= 0 and sys.platform == "win32":
# Join the monitoring thread.
! if self.__monitor_thread is not None:
! self.__monitor_thread.join()
return status
def __UseSeparateProcessGroupForChild(self):
More information about the qmtest
mailing list