Backed out changeset 31b7d1785eb2 due to automation.py bustage
This commit is contained in:
Родитель
96468a2193
Коммит
3e54911721
|
@ -74,13 +74,6 @@ _IS_CYGWIN = False
|
|||
#expand _IS_DEBUG_BUILD = __IS_DEBUG_BUILD__
|
||||
#expand _CRASHREPORTER = __CRASHREPORTER__ == 1
|
||||
|
||||
|
||||
if _IS_WIN32:
|
||||
import ctypes, ctypes.wintypes, time, msvcrt
|
||||
else:
|
||||
import errno
|
||||
|
||||
|
||||
#################
|
||||
# PROFILE SETUP #
|
||||
#################
|
||||
|
@ -473,7 +466,7 @@ user_pref("camino.use_system_proxy_settings", false); // Camino-only, harmless t
|
|||
if env == None:
|
||||
env = dict(os.environ)
|
||||
|
||||
ldLibraryPath = os.path.abspath(os.path.join(SCRIPT_DIR, xrePath))
|
||||
ldLibraryPath = os.path.abspath(os.path.join(self.SCRIPT_DIR, xrePath))
|
||||
if self.UNIXISH or self.IS_MAC:
|
||||
envVar = "LD_LIBRARY_PATH"
|
||||
if self.IS_MAC:
|
||||
|
@ -497,6 +490,10 @@ user_pref("camino.use_system_proxy_settings", false); // Camino-only, harmless t
|
|||
return env
|
||||
|
||||
if IS_WIN32:
|
||||
ctypes = __import__('ctypes')
|
||||
wintypes = __import__('ctypes.wintypes')
|
||||
time = __import__('time')
|
||||
msvcrt = __import__('msvcrt')
|
||||
PeekNamedPipe = ctypes.windll.kernel32.PeekNamedPipe
|
||||
GetLastError = ctypes.windll.kernel32.GetLastError
|
||||
|
||||
|
@ -510,11 +507,11 @@ user_pref("camino.use_system_proxy_settings", false); // Camino-only, harmless t
|
|||
if timeout is None:
|
||||
# shortcut to allow callers to pass in "None" for no timeout.
|
||||
return (f.readline(), False)
|
||||
x = msvcrt.get_osfhandle(f.fileno())
|
||||
l = ctypes.c_long()
|
||||
done = time.time() + timeout
|
||||
while time.time() < done:
|
||||
if self.PeekNamedPipe(x, None, 0, None, ctypes.byref(l), None) == 0:
|
||||
x = self.msvcrt.get_osfhandle(f.fileno())
|
||||
l = self.ctypes.c_long()
|
||||
done = self.time.time() + timeout
|
||||
while self.time.time() < done:
|
||||
if self.PeekNamedPipe(x, None, 0, None, self.ctypes.byref(l), None) == 0:
|
||||
err = self.GetLastError()
|
||||
if err == 38 or err == 109: # ERROR_HANDLE_EOF || ERROR_BROKEN_PIPE
|
||||
return ('', False)
|
||||
|
@ -524,18 +521,18 @@ user_pref("camino.use_system_proxy_settings", false); // Camino-only, harmless t
|
|||
# we're assuming that the output is line-buffered,
|
||||
# which is not unreasonable
|
||||
return (f.readline(), False)
|
||||
time.sleep(0.01)
|
||||
self.time.sleep(0.01)
|
||||
return ('', True)
|
||||
|
||||
def isPidAlive(self, pid):
|
||||
STILL_ACTIVE = 259
|
||||
PROCESS_QUERY_LIMITED_INFORMATION = 0x1000
|
||||
pHandle = ctypes.windll.kernel32.OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION, 0, pid)
|
||||
pHandle = self.ctypes.windll.kernel32.OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION, 0, pid)
|
||||
if not pHandle:
|
||||
return False
|
||||
pExitCode = ctypes.wintypes.DWORD()
|
||||
ctypes.windll.kernel32.GetExitCodeProcess(pHandle, self.ctypes.byref(pExitCode))
|
||||
ctypes.windll.kernel32.CloseHandle(pHandle)
|
||||
self.ctypes.windll.kernel32.GetExitCodeProcess(pHandle, self.ctypes.byref(pExitCode))
|
||||
self.ctypes.windll.kernel32.CloseHandle(pHandle)
|
||||
if (pExitCode.value == STILL_ACTIVE):
|
||||
return True
|
||||
else:
|
||||
|
@ -543,13 +540,14 @@ user_pref("camino.use_system_proxy_settings", false); // Camino-only, harmless t
|
|||
|
||||
def killPid(self, pid):
|
||||
PROCESS_TERMINATE = 0x0001
|
||||
pHandle = ctypes.windll.kernel32.OpenProcess(PROCESS_TERMINATE, 0, pid)
|
||||
pHandle = self.ctypes.windll.kernel32.OpenProcess(PROCESS_TERMINATE, 0, pid)
|
||||
if not pHandle:
|
||||
return
|
||||
success = ctypes.windll.kernel32.TerminateProcess(pHandle, 1)
|
||||
ctypes.windll.kernel32.CloseHandle(pHandle)
|
||||
success = self.ctypes.windll.kernel32.TerminateProcess(pHandle, 1)
|
||||
self.ctypes.windll.kernel32.CloseHandle(pHandle)
|
||||
|
||||
else:
|
||||
errno = __import__('errno')
|
||||
|
||||
def readWithTimeout(self, f, timeout):
|
||||
"""Try to read a line of output from the file object |f|. If no output
|
||||
|
@ -577,7 +575,7 @@ user_pref("camino.use_system_proxy_settings", false); // Camino-only, harmless t
|
|||
except OSError, err:
|
||||
# Catch the errors we might expect from os.kill/os.waitpid,
|
||||
# and re-raise any others
|
||||
if err.errno == errno.ESRCH or err.errno == errno.ECHILD:
|
||||
if err.errno == self.errno.ESRCH or err.errno == self.errno.ECHILD:
|
||||
return False
|
||||
raise
|
||||
|
||||
|
@ -763,7 +761,7 @@ user_pref("camino.use_system_proxy_settings", false); // Camino-only, harmless t
|
|||
|
||||
# Do a final check for zombie child processes.
|
||||
self.checkForZombies(processLog)
|
||||
automationutils.checkForCrashes(os.path.join(profileDir, "minidumps"), symbolsPath)
|
||||
self.automationutils.checkForCrashes(os.path.join(profileDir, "minidumps"), symbolsPath)
|
||||
|
||||
if os.path.exists(processLog):
|
||||
os.unlink(processLog)
|
||||
|
|
Загрузка…
Ссылка в новой задаче