Fixed anykey so that it flushs STDIN before waiting for input

This commit is contained in:
bluesaxman 2021-09-10 12:24:57 -06:00
parent db068908d6
commit 41f611c1e6

View File

@ -61,6 +61,7 @@ my @good = ();
# for providing a waiting prompt
sub anykey {
$termios->setattr(fileno(STDIN), TCSAFLUSH);
print shift;
return getc(STDIN);
}
@ -125,7 +126,7 @@ sub wipethemdrives {
close($diskw);
print "Wipe attempt complete, checking...";
# Read
system("hdparm -F ".$disks->{$diskid}{path}." 1> /dev/null 2>/dev/null") and do {
system("hdparm -F ".$disks->{$diskid}{path}." 1>/dev/null 2>/dev/null") and do {
print "Cannot flush drive buffer: $!\n";
print "Disk considered $color{red}FAILED$color{reset}\n";
$disks->{$diskid}{failure} = "Cannot flush drive buffer";