Index: build/android/pylib/utils/device_temp_file.py |
diff --git a/build/android/pylib/utils/device_temp_file.py b/build/android/pylib/utils/device_temp_file.py |
index 4623b9047bb37fc3b35fab4fc07dba834f509538..1364f7a7d93872fe757c2ca96e9ccb270781c1e3 100644 |
--- a/build/android/pylib/utils/device_temp_file.py |
+++ b/build/android/pylib/utils/device_temp_file.py |
@@ -6,6 +6,8 @@ |
# pylint: disable=W0622 |
+import threading |
+ |
from pylib import cmd_helper |
from pylib.device import device_errors |
@@ -43,11 +45,16 @@ class DeviceTempFile(object): |
def close(self): |
"""Deletes the temporary file from the device.""" |
# ignore exception if the file is already gone. |
- try: |
- self._adb.Shell('rm -f %s' % self.name_quoted) |
- except device_errors.AdbCommandFailedError: |
- # file does not exist on Android version without 'rm -f' support (ICS) |
- pass |
+ def helper(): |
+ try: |
+ self._adb.Shell('rm -f %s' % self.name_quoted, expect_status=None) |
+ except device_errors.AdbCommandFailedError: |
+ # file does not exist on Android version without 'rm -f' support (ICS) |
+ pass |
+ |
+ # It shouldn't matter when the temp file gets deleted, so do so |
+ # asynchronously. |
+ threading.Thread(target=helper).start() |
def __enter__(self): |
return self |