Check for terminated processes properly
Some checks failed
CI via Tox and perl / tox (pull_request) Successful in 1m58s
CI via Tox and perl / perl (pull_request) Successful in 6m15s
CI via Tox and perl / checkwiki (pull_request) Failing after 1m24s

This commit is contained in:
Lukáš Růžička 2026-04-28 10:49:43 +02:00
commit 2469102579

View file

@ -15,9 +15,11 @@ sub run {
# Remove the user clear the system and force the gnome-initial-setup
# to start on new boot.
assert_script_run("loginctl kill-user $username");
# that might switch us back to GDM, switch away if so
assert_script_run("loginctl kill-user $username", timeout => 120);
# closing the user might switch us back to GDM, let's go back there
$self->root_console(tty => 3) if (check_screen 'graphical_login', timeout => 30);
# repeat checking that all processes are terminated, then proceed to delete the user
assert_script_run("for i in {1..30}; do ! pgrep -u $username >/dev/null && exit 0; sleep 1; done; pgrep -au $username; exit 1");
assert_script_run("userdel -r $username");
# Reboot the system to trigger GNOME initial setup