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
|
@ -41,12 +41,6 @@ def test_sanity_checks():
|
|||
func("tui", output_return=True)
|
||||
assert str(e.value).startswith("Can't use output_return with")
|
||||
|
||||
# kill_as_root
|
||||
func("log", kill_as_root=True)
|
||||
with pytest.raises(RuntimeError) as e:
|
||||
func("tui", kill_as_root=True)
|
||||
assert str(e.value).startswith("Can't use kill_as_root with")
|
||||
|
||||
|
||||
def test_background(args):
|
||||
# Sleep in background
|
||||
|
@ -90,7 +84,7 @@ def test_foreground_pipe(args):
|
|||
cmd = ["sudo", "sh", "-c", "printf first; sleep 2; printf second"]
|
||||
args.timeout = 0.3
|
||||
ret = func(args, cmd, output_return=True, output_timeout=True,
|
||||
kill_as_root=True)
|
||||
sudo=True)
|
||||
assert ret == (-9, "first")
|
||||
|
||||
# Finish before timeout
|
||||
|
@ -108,7 +102,7 @@ def test_foreground_pipe(args):
|
|||
"sleep 10 | sleep 20 | sleep 30"]
|
||||
args.timeout = 0.3
|
||||
ret = func(args, cmd, output_return=True, output_timeout=True,
|
||||
kill_as_root=True)
|
||||
sudo=True)
|
||||
pgid = str(ret[1])
|
||||
|
||||
cmd = ["ps", "-e", "-o", "pgid=,comm=", "--noheaders"]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue