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 # for providing a waiting prompt
sub anykey { sub anykey {
$termios->setattr(fileno(STDIN), TCSAFLUSH);
print shift; print shift;
return getc(STDIN); return getc(STDIN);
} }
@ -125,7 +126,7 @@ sub wipethemdrives {
close($diskw); close($diskw);
print "Wipe attempt complete, checking..."; print "Wipe attempt complete, checking...";
# Read # 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 "Cannot flush drive buffer: $!\n";
print "Disk considered $color{red}FAILED$color{reset}\n"; print "Disk considered $color{red}FAILED$color{reset}\n";
$disks->{$diskid}{failure} = "Cannot flush drive buffer"; $disks->{$diskid}{failure} = "Cannot flush drive buffer";