From 41f611c1e62eec73b54a7671ec640caaefcf1906 Mon Sep 17 00:00:00 2001 From: bluesaxman Date: Fri, 10 Sep 2021 12:24:57 -0600 Subject: [PATCH] Fixed anykey so that it flushs STDIN before waiting for input --- wipe.pl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/wipe.pl b/wipe.pl index f9e0d13..010782f 100755 --- a/wipe.pl +++ b/wipe.pl @@ -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";