forked from Mirror/pmbootstrap
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().
This commit is contained in:
parent
6411aa4791
commit
978e6cf7d3
1 changed files with 15 additions and 2 deletions
|
@ -143,6 +143,20 @@ def root(
|
||||||
) -> str: ...
|
) -> 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(
|
def root(
|
||||||
cmds: Sequence[PathString],
|
cmds: Sequence[PathString],
|
||||||
chroot: Chroot = Chroot.native(),
|
chroot: Chroot = Chroot.native(),
|
||||||
|
@ -195,8 +209,7 @@ def userm(
|
||||||
|
|
||||||
flat_cmd = pmb.helpers.run_core.flat_cmd(cmds, env=env)
|
flat_cmd = pmb.helpers.run_core.flat_cmd(cmds, env=env)
|
||||||
cmd = ["busybox", "su", "pmos", "-c", flat_cmd]
|
cmd = ["busybox", "su", "pmos", "-c", flat_cmd]
|
||||||
# Can't figure out why this one fails :(
|
return pmb.chroot.root(
|
||||||
return pmb.chroot.root( # type: ignore[call-overload]
|
|
||||||
cmd, chroot, working_dir, output, output_return, check, {}, add_proxy_env_vars=False
|
cmd, chroot, working_dir, output, output_return, check, {}, add_proxy_env_vars=False
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue