From f70b8ec9431b56887499f27077349ee8c616b219 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Tue, 7 Jul 2020 17:35:32 -0700 Subject: [PATCH] post_fail_hook: don't try ctrl-c on serial console Can't do that. Signed-off-by: Adam Williamson --- lib/installedtest.pm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/installedtest.pm b/lib/installedtest.pm index dbaa97f0..a86c1818 100644 --- a/lib/installedtest.pm +++ b/lib/installedtest.pm @@ -9,7 +9,7 @@ use base 'basetest'; # should be used when with tests, where system is already installed, e. g all parts # of upgrade tests, postinstall phases... -use testapi; +use testapi qw(is_serial_terminal :DEFAULT); use utils; sub root_console { @@ -58,7 +58,11 @@ sub post_fail_hook { # rely on dnf always working (it fails in emergency mode, not sure # why), so try it. if we don't get a return code, process may be # stuck waiting on network or something, so hit ctrl-c - send_key "ctrl-c" unless (script_run "dnf -y install tar", 180); + unless (script_run "dnf -y install tar", 180) { + unless (is_serial_terminal) { + send_key "ctrl-c"; + } + } # if we don't have tar or a network connection, we'll try and at # least send out *some* kinda info via the serial line