lib.ExecContext, lib.FileContext: Fix temp file leak and log messages #86
2 changed files with 3 additions and 3 deletions
|
|
@ -553,14 +553,14 @@ class ExecContext(Base):
|
|||
for cmd in cmds:
|
||||
log(DEBUG, f'{self.log_name}: Running {pretty_cmd(cmd.cmd, wd)}')
|
||||
ret = await __run(cmd.cmd, cmd_input = cmd.cmd_input)
|
||||
tmp_file = None # Has been successfully moved at this point
|
||||
tmp_file = None # All commands, including the final mv, succeeded
|
||||
return ret
|
||||
finally:
|
||||
if tmp_file is not None:
|
||||
await self.erase(tmp_file)
|
||||
await self.close()
|
||||
except Exception as e:
|
||||
msg = f'Failed to get {path} from {self.root} ({str(e)})'
|
||||
msg = f'Failed to put content to {path} on {self.root} ({str(e)})'
|
||||
if throw:
|
||||
raise Exception(msg)
|
||||
log(ERR, msg)
|
||||
|
|
|
|||
|
|
@ -287,7 +287,7 @@ class FileContext(abc.ABC):
|
|||
DEBUG,
|
||||
(
|
||||
f"{self.log_name} doesn't implement stat(), judging by trailing "
|
||||
'slash if {path} is a directory'
|
||||
f'slash if {path} is a directory'
|
||||
),
|
||||
)
|
||||
return path[-1] == '/'
|
||||
|
|
|
|||
Loading…
Reference in a new issue