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:
|
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:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user