lib.FileContext.put(): Simplify

.put() has some commands to _run(), and it uses its own CallContext
for them. Since that pattern only replicates what run() does anyway,
we could just as well use run() itself with less code, so do that.

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2026-04-17 14:10:29 +02:00
commit bbb2d16956

View file

@ -296,23 +296,8 @@ class ExecContext(Base):
from .util import pretty_cmd from .util import pretty_cmd
async def __run(cmd: list[str], cmd_input: Input=InputMode.NonInteractive) -> Result: async def __run(cmd: list[str], cmd_input: Input=InputMode.NonInteractive, **kwargs) -> Result:
with self.CallContext(self, title=title, cmd=cmd, cmd_input=cmd_input, wd=None, return await self.run(cmd, cmd_input=cmd_input, **kwargs)
log_prefix='|', throw=True, verbose=verbose) as cc:
try:
ret = await self._run(
cmd=cc.cmd,
wd=cc.wd,
verbose=cc.verbose,
cmd_input=cc.cmd_input,
env=None,
interactive=cc.interactive,
log_prefix=cc.log_prefix
)
except Exception as e:
return cc.exception(ret, e)
cc.check_exit_code(ret)
return ret
ret = Result(None, None, 1) ret = Result(None, None, 1)
try: try: