Skip to content

Commit 1cb9e64

Browse files
jpoimboerostedt
authored andcommitted
ktest: Cleanup terminal on dodie() failure
If dodie() is called with the console open, restore the terminal's original settings before dying. Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Josh Poimboeuf <[email protected]> Signed-off-by: Steven Rostedt <[email protected]>
1 parent 4bf6e1f commit 1cb9e64

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tools/testing/ktest/ktest.pl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1407,6 +1407,11 @@ sub dodie {
14071407
print " See $opt{LOG_FILE} for more info.\n";
14081408
}
14091409

1410+
if ($monitor_cnt) {
1411+
# restore terminal settings
1412+
system("stty $stty_orig");
1413+
}
1414+
14101415
die @_, "\n";
14111416
}
14121417

@@ -1449,7 +1454,7 @@ sub exec_console {
14491454
close($pts);
14501455

14511456
exec $console or
1452-
dodie "Can't open console $console";
1457+
die "Can't open console $console";
14531458
}
14541459

14551460
sub open_console {

0 commit comments

Comments
 (0)