From c33b137e88a2f226c94b55a505b08a7298b24a7b Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Feb 23 2022 00:54:03 +0000 Subject: Tweak desktop_vt tty detector a bit The intent is that if the ps check finds nothing we'll use the loginctl output, but that doesn't work because script_output doesn't return the output if the script fails. There's an arg you can pass to make it do so, but let's just make it always succeed instead, by adding a ||: to the second grep like we have for the first. Also, I noticed this problem because the ps check started not working on F36 KDE because none of the processes we check for are shown as running on a tty, so let's add one more that *is* shown as running on a tty... Signed-off-by: Adam Williamson --- diff --git a/lib/utils.pm b/lib/utils.pm index ecf5865..2a7a6d1 100644 --- a/lib/utils.pm +++ b/lib/utils.pm @@ -267,7 +267,7 @@ sub desktop_vt { # os-autoinst calls the script with 'bash -e' which causes it to # stop as soon as any command fails, so we use ||: to make the # first grep return 0 even if it matches nothing - eval { $xout = script_output ' loginctl | grep test ||:; ps -e | egrep "(gnome-session|Xwayland|Xorg)" | grep -o tty[0-9]' }; + eval { $xout = script_output ' loginctl | grep test ||:; ps -e | egrep "(startplasma|gnome-session|Xwayland|Xorg)" | grep -o tty[0-9] ||:' }; my $tty = 1; # default while ($xout =~ /tty(\d)/g) { $tty = $1; # most recent match is probably best