reverted grml-quickconfig: no more unnecessary wakeups
authorMichael Gebetsroither <michael.geb@gmx.at>
Fri, 9 Nov 2007 15:33:48 +0000 (16:33 +0100)
committerMichael Gebetsroither <michael.geb@gmx.at>
Fri, 9 Nov 2007 15:33:48 +0000 (16:33 +0100)
Term::ReadKey seems to be buggy, the normal blocking call ReadKey(0) is not
blocking anymore after returning from an grml-x started through
grml-quickconfig.

usr_sbin/grml-quickconfig

index a8a0df0..a7c2a9b 100755 (executable)
@@ -10,6 +10,7 @@
 # menu with quick config options
 
 use Term::ReadKey;
+use Time::HiRes;
 
 # enable alternate charset support (needed for screen)
 print "\e(B\e)0";
@@ -99,7 +100,10 @@ while(1) {
 EOF
   print "Press a key: ".$M;
   ReadMode 4; # Turn off controls keys
-  while (not defined ($x = ReadKey(0))) {}
+  while (not defined ($x = ReadKey(-1))) {
+      # No key yet
+      Time::HiRes::sleep(0.5); 
+  }
   ReadMode 0; # Reset tty mode before exiting
 
   print $N.$/.$/;
@@ -122,7 +126,10 @@ EOF
 EOF
       print "Press a key: ".$M;
       ReadMode 4; # Turn off controls keys
-      while (not defined ($x = ReadKey(0))) {}
+      while (not defined ($x = ReadKey(-1))) {
+    # No key yet
+        Time::HiRes::sleep(0.5); 
+      }
       ReadMode 0; # Reset tty mode before exiting
 
       print $N.$/.$/;