Skip to content

Commit

Permalink
ktest: Cleanup terminal on dodie() failure
Browse files Browse the repository at this point in the history
If dodie() is called with the console open, restore the terminal's
original settings before dying.

Link: http://lkml.kernel.org/r/20150130025453.GB20952@treble.redhat.com

Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
  • Loading branch information
Josh Poimboeuf authored and Steven Rostedt committed Feb 2, 2015
1 parent 4bf6e1f commit 1cb9e64
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tools/testing/ktest/ktest.pl
Original file line number Diff line number Diff line change
Expand Up @@ -1407,6 +1407,11 @@ sub dodie {
print " See $opt{LOG_FILE} for more info.\n";
}

if ($monitor_cnt) {
# restore terminal settings
system("stty $stty_orig");
}

die @_, "\n";
}

Expand Down Expand Up @@ -1449,7 +1454,7 @@ sub exec_console {
close($pts);

exec $console or
dodie "Can't open console $console";
die "Can't open console $console";
}

sub open_console {
Expand Down

0 comments on commit 1cb9e64

Please sign in to comment.