lib.ExecContext,Local: Remove callback default params

Remove defaults from protected callback function parameters. They
have to be decided by the base class's public API.

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2026-03-06 17:01:05 +01:00
commit 1325222fbd
2 changed files with 28 additions and 15 deletions

View file

@ -14,14 +14,14 @@ class Local(Base):
async def _run(
self,
args: list[str],
wd: str|None = None,
throw: bool = True,
verbose: bool = False,
cmd_input: str|None = None,
env: dict[str, str]|None = None,
title: str=None,
output_encoding: str|None = None, # None => unchanged; "bytes" => return raw bytes
) -> tuple[str|bytes|None, str|bytes|None]:
wd: str|None,
throw: bool,
verbose: bool,
cmd_input: str|None,
env: dict[str, str]|None,
title: str,
output_encoding: str|None, # None => unchanged; "bytes" => return raw bytes
) -> Result:
want_bytes = (output_encoding == "bytes")
@ -197,7 +197,7 @@ class Local(Base):
if verbose and not interactive:
log(NOTICE, '`' + delim + ' <')
async def _sudo(self, cmd: list[str], mod_env: dict[str, str] = {}, opts: list[str]=[], verbose=True) -> Result:
async def _sudo(self, cmd: list[str], mod_env: dict[str, str], opts: list[str], verbose: bool) -> Result:
env: dict[str, str]|None = None
cmd_input: str|None = None
if mod_env:
@ -212,4 +212,6 @@ class Local(Base):
cmdline.extend(cmd)
if self.interactive:
cmd_input = "mode:interactive"
return await self._run(cmdline, throw=True, verbose=verbose, env=env, cmd_input=cmd_input)
# Need to call the base class function, because _run() needs more
# parameters than we have values for
return await self.run(cmdline, throw=True, verbose=verbose, env=env, cmd_input=cmd_input)