lib.ExecApp: Add class #76

Closed
Jan Lindemann wants to merge 17 commits from jan/feature/20260822-lib-execapp-add-class into master AGit
Showing only changes of commit ebe187788a - Show all commits

lib.pm.dpkg: Pass context to run_sudo()

_run() forwards the execution context to run_cmd() when sudo is not
requested, but calls run_sudo(cmd) without the context in the sudo
case. run_sudo() then falls back to a fresh local context, so sudoed
dpkg and dpkg-query commands run on the local machine instead of on
the given context, e.g. Distro._delete() on a remote host.

Pass the context and non-interactive stdin to run_sudo() as well.

Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v0.84.2
Signed-off-by: Jan Lindemann <jan@janware.com>
Jan Lindemann 2026-08-16 07:01:14 +02:00
Signed by: Jan Lindemann
GPG key ID: 3750640C9E25DD61

View file

@ -29,7 +29,7 @@ async def _run(
cmd: list[str], sudo: bool = False, ec: ExecContext | None = None
) -> str:
return (
await run_sudo(cmd)
await run_sudo(cmd, ec = ec, cmd_input = InputMode.NonInteractive)
if sudo else await run_cmd(cmd, ec = ec, cmd_input = InputMode.NonInteractive)
).stdout_str