mirror of
https://github.com/ARM-software/devlib.git
synced 2025-01-30 17:50:46 +00:00
target: Make Target.make_temp() async-compatible
This commit is contained in:
parent
52281051b2
commit
3c37bf3de1
@ -1153,8 +1153,8 @@ fi
|
||||
else:
|
||||
raise
|
||||
|
||||
@contextmanager
|
||||
def make_temp(self, is_directory=True, directory='', prefix='devlib-test'):
|
||||
@asyn.asynccontextmanager
|
||||
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.
|
||||
|
||||
@ -1179,11 +1179,11 @@ fi
|
||||
if is_directory:
|
||||
cmd += ' -d'
|
||||
|
||||
temp_obj = self.execute(cmd).strip()
|
||||
temp_obj = (await self.execute.asyn(cmd)).strip()
|
||||
yield temp_obj
|
||||
finally:
|
||||
if temp_obj is not None:
|
||||
self.remove(temp_obj)
|
||||
await self.remove.asyn(temp_obj)
|
||||
|
||||
def reset(self):
|
||||
try:
|
||||
|
Loading…
x
Reference in New Issue
Block a user