Skip to content
Snippets Groups Projects
Unverified Commit 978e6cf7 authored by Newbyte's avatar Newbyte :snowflake: Committed by Oliver Smith
Browse files

pmb.chroot.run: Add another overload for root() (MR 2515)

Having a more generic overload like this fixes the issue where mypy
complains about no matching overloads at the call site in userm().
parent 6411aa47
No related branches found
No related tags found
1 merge request!2515pmb.chroot.run: Add another overload for root() + pmb.parse.apkindex: Improve parse_add_block() type hint
......@@ -143,6 +143,20 @@ def root(
) -> str: ...
@overload
def root(
cmds: Sequence[PathString],
chroot: Chroot = ...,
working_dir: PurePath = ...,
output: RunOutputType = ...,
output_return: bool = ...,
check: bool | None = ...,
env: Env = ...,
disable_timeout: bool = ...,
add_proxy_env_vars: bool = ...,
) -> subprocess.Popen | int | str: ...
def root(
cmds: Sequence[PathString],
chroot: Chroot = Chroot.native(),
......@@ -195,8 +209,7 @@ def userm(
flat_cmd = pmb.helpers.run_core.flat_cmd(cmds, env=env)
cmd = ["busybox", "su", "pmos", "-c", flat_cmd]
# Can't figure out why this one fails :(
return pmb.chroot.root( # type: ignore[call-overload]
return pmb.chroot.root(
cmd, chroot, working_dir, output, output_return, check, {}, add_proxy_env_vars=False
)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment