forked from Mirror/pmbootstrap
chroot: run: support running multiple commands with one call (MR 2252)
Building the command strings and entering the chroot is a not-insubstantial amount of overhead. Implement support for running multiple commands with a new pmb.chroot.rootm() function. TODO: add alternative for chroot.user and run.root/user. Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
This commit is contained in:
parent
3a74018f89
commit
8a61d67053
5 changed files with 26 additions and 17 deletions
|
@ -32,7 +32,7 @@ def user(cmd: Sequence[PathString], working_dir: Optional[Path] = None, output:
|
|||
env = env.copy()
|
||||
pmb.helpers.run_core.add_proxy_env_vars(env)
|
||||
if env:
|
||||
cmd_parts = ["sh", "-c", pmb.helpers.run_core.flat_cmd(cmd_parts, env=env)]
|
||||
cmd_parts = ["sh", "-c", pmb.helpers.run_core.flat_cmd([cmd_parts], env=env)]
|
||||
return pmb.helpers.run_core.core(msg, cmd_parts, working_dir, output,
|
||||
output_return, check, sudo)
|
||||
|
||||
|
@ -60,7 +60,7 @@ def root(cmd: Sequence[PathString], working_dir=None, output="log", output_retur
|
|||
pmb.helpers.run_core.add_proxy_env_vars(env)
|
||||
|
||||
if env:
|
||||
cmd = ["sh", "-c", pmb.helpers.run_core.flat_cmd(cmd, env=env)]
|
||||
cmd = ["sh", "-c", pmb.helpers.run_core.flat_cmd([cmd], env=env)]
|
||||
cmd = pmb.config.sudo(cmd)
|
||||
|
||||
return user(cmd, working_dir, output, output_return, check, env,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue