Make fixes as requested by AI
Some checks failed
CI via Tox and perl / tox (pull_request) Has been cancelled
CI via Tox and perl / perl (pull_request) Has been cancelled
CI via Tox and perl / checkwiki (pull_request) Has been cancelled

This commit is contained in:
Lukáš Růžička 2026-04-29 11:19:49 +02:00
commit 92fbb0ca56

View file

@ -6,12 +6,7 @@ use utils;
sub run_as_user {
my ($user, $cmd) = @_;
enter_cmd("su - $user");
sleep(2);
my $output = script_output($cmd, timeout => 60);
enter_cmd("exit");
sleep(2);
return $output;
return script_output("su - $user -c '$cmd'", timeout => 60);
}
sub assert_as_user_eq {
@ -32,7 +27,7 @@ sub assert_password {
my ($user, $password) = @_;
enter_cmd("su - $user"); # Switch to user account to lose admin rights.
# The following command will not show the username without the correct password
my $result = script_run("su - $user -c 'whoami' <<< $password | grep -x $user");
my $result = script_run("echo $password | sudo -S -u $user whoami | grep -x $user");
enter_cmd("exit");
return $result;
}