1
0
mirror of https://github.com/ARM-software/devlib.git synced 2025-01-31 02:00:45 +00:00

target: Make Target.make_temp() async-compatible

This commit is contained in:
Douglas Raillard 2024-05-30 10:47:23 +01:00 committed by Marc Bonnici
parent 52281051b2
commit 3c37bf3de1

View File

@ -1153,8 +1153,8 @@ fi
else: else:
raise raise
@contextmanager @asyn.asynccontextmanager
def make_temp(self, is_directory=True, directory='', prefix='devlib-test'): async def make_temp(self, is_directory=True, directory='', prefix='devlib-test'):
""" """
Creates temporary file/folder on target and deletes it once it's done. Creates temporary file/folder on target and deletes it once it's done.
@ -1179,11 +1179,11 @@ fi
if is_directory: if is_directory:
cmd += ' -d' cmd += ' -d'
temp_obj = self.execute(cmd).strip() temp_obj = (await self.execute.asyn(cmd)).strip()
yield temp_obj yield temp_obj
finally: finally:
if temp_obj is not None: if temp_obj is not None:
self.remove(temp_obj) await self.remove.asyn(temp_obj)
def reset(self): def reset(self):
try: try: