forked from Mirror/pmbootstrap
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:
parent
27127f1cae
commit
8842a7d5c0
5 changed files with 23 additions and 43 deletions
|
@ -34,7 +34,7 @@ def flat_cmd(cmd, working_dir=None, env={}):
|
|||
|
||||
|
||||
def user(args, cmd, working_dir=None, output="log", output_return=False,
|
||||
check=None, env={}, kill_as_root=False):
|
||||
check=None, env={}, sudo=False):
|
||||
"""
|
||||
Run a command on the host system as user.
|
||||
|
||||
|
@ -56,7 +56,7 @@ def user(args, cmd, working_dir=None, output="log", output_return=False,
|
|||
if env:
|
||||
cmd = ["sh", "-c", flat_cmd(cmd, env=env)]
|
||||
return pmb.helpers.run_core.core(args, msg, cmd, working_dir, output,
|
||||
output_return, check, kill_as_root)
|
||||
output_return, check, sudo)
|
||||
|
||||
|
||||
def root(args, cmd, working_dir=None, output="log", output_return=False,
|
||||
|
@ -74,8 +74,5 @@ def root(args, cmd, working_dir=None, output="log", output_return=False,
|
|||
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,
|
||||
kill_as_root)
|
||||
True)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue