mirror of
ssh://git.janware.com/janware/proj/jw-pkg
synced 2026-04-24 09:13:37 +02:00
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:
parent
0d6eeeadcf
commit
bbb2d16956
1 changed files with 2 additions and 17 deletions
|
|
@ -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:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue