Skip to contentSkip to conversation

ktest: Restore stty setting at first in dodie

PATCH New Masami Hiramatsu (Google) 1 participant 1 message Jan 20, 2023 Ktest

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ktest: Restore stty setting at first in dodie

From: Masami Hiramatsu (Google) <[email protected]>

The do_send_email() will call die before restoring stty if sendmail setting is not correct or sendmail is not installed. It is safer to restore it in the beginning of dodie().

---
 tools/testing/ktest/ktest.pl |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
tools/testing/ktest/ktest.pl +5 -5
index ac59999ed3de..9fb3d79b084c 100755
@@ -1535,6 +1535,11 @@ sub dodie {
     return if ($in_die);
     $in_die = 1;
 
+    if ($monitor_cnt) {
+	# restore terminal settings
+	system("stty $stty_orig");
+    }
+
     my $i = $iteration;
 
     doprint "CRITICAL FAILURE... [TEST $i] ", @_, "\n";
@@ -1581,11 +1586,6 @@ sub dodie {
 		"Your test started at $script_start_time has failed with:\n@_\n", $log_file);
     }
 
-    if ($monitor_cnt) {
-	# restore terminal settings
-	system("stty $stty_orig");
-    }
-
     if (defined($post_test)) {
 	run_command $post_test;
     }