pmb.helpers.run_core: change kill_as_root to sudo (MR 1997)

Replace the "kill_as_root" argument with a much simpler "sudo" argument
and remove the now obsolete check for the output mode of "kill_as_root".

"kill_as_root" would only get set to True if both conditions are met:
a) command is running with sudo
b) command is running with an output mode ("log" or "stdout") where
   pmb.helpers.run_core would kill it if it does not output anything
   before a timeout is reached

The new "sudo" argument just indicates if the command is running with
sudo (a), regardless of the output mode (b).
This commit is contained in:
Johannes Marbach 2020-12-09 19:41:12 +01:00
parent 27127f1cae
commit 8842a7d5c0
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
5 changed files with 23 additions and 43 deletions

View file

@ -71,6 +71,5 @@ def root(args, cmd, suffix="native", working_dir="/", output="log",
pmb.helpers.run.flat_cmd(cmd, working_dir)]
cmd_sudo = ["sudo", "env", "-i", executables["sh"], "-c",
pmb.helpers.run.flat_cmd(cmd_chroot, env=env_all)]
kill_as_root = output in ["log", "stdout"]
return pmb.helpers.run_core.core(args, msg, cmd_sudo, None, output,
output_return, check, kill_as_root, disable_timeout)
output_return, check, True, disable_timeout)