Make pmb.helpers.run.root support non-timeout output modes (MR 1996)

Before this commit, pmb.helpers.run_core.sanity_checks would raise
a runtime error when pmb.helpers.run.root was called with an output
mode that did not support timeouts (like background).
This commit is contained in:
Johannes Marbach 2020-12-05 14:19:39 +01:00 committed by Oliver Smith
parent de175bfb1f
commit 82d149c85d
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
3 changed files with 15 additions and 3 deletions

View file

@ -73,5 +73,9 @@ def root(args, cmd, working_dir=None, output="log", output_return=False,
if env:
cmd = ["sh", "-c", flat_cmd(cmd, env=env)]
cmd = ["sudo"] + cmd
# pmbootstrap shall use 'sudo kill' to get rid of timed out programs
kill_as_root = output in pmb.config.run_outputs_with_timeout or None
return user(args, cmd, working_dir, output, output_return, check, env,
True)
kill_as_root)