# HG changeset patch # User Makoto Kato # Parent 916497e295fe6c3b5e8082045add889fd555dff6 --- a/testing/mozbase/mozdevice/mozdevice/adb.py +++ b/testing/mozbase/mozdevice/mozdevice/adb.py @@ -30,17 +30,18 @@ from . import version_codes class ADBProcess(object): """ADBProcess encapsulates the data related to executing the adb process.""" def __init__(self, args): #: command argument list. self.args = args #: Temporary file handle to be used for stdout. - self.stdout_file = tempfile.NamedTemporaryFile(mode="w+b") + #: delete=False is required on Windows's python. (Maybe leak) + self.stdout_file = tempfile.NamedTemporaryFile(mode='w+b', delete=False) #: boolean indicating if the command timed out. self.timedout = None #: exitcode of the process. self.exitcode = None #: subprocess Process object used to execute the command. @@ -356,16 +357,17 @@ class ADBCommand(object): output, ) ) return output finally: if adb_process and isinstance(adb_process.stdout_file, io.IOBase): adb_process.stdout_file.close() + os.remove(adb_process.stdout_file.name) class ADBHost(ADBCommand): """ADBHost provides a basic interface to adb host commands which do not target a specific device. :param str adb: path to adb executable. Defaults to 'adb'. :param str adb_host: host of the adb server.