Procházet zdrojové kódy

read and discard zero chars to initialise STDIN

Resolves issue in cygwin on windows 8.1 where password field is skipped. See later comments of issue #2831.
Tom Kay před 10 roky
rodič
revize
526a4d7c9e
1 změnil soubory, kde provedl 1 přidání a 1 odebrání
  1. 1 1
      src/Composer/IO/ConsoleIO.php

+ 1 - 1
src/Composer/IO/ConsoleIO.php

@@ -177,7 +177,7 @@ class ConsoleIO extends BaseIO
             // use bash if it's present
             if ($finder->find('bash') && $finder->find('stty')) {
                 $this->write($question, false);
-                $value = rtrim(shell_exec('bash -c "stty -echo; read -r mypassword; stty echo; echo $mypassword"'));
+                $value = rtrim(shell_exec('bash -c "stty -echo; read -n0 discard; read -r mypassword; stty echo; echo $mypassword"'));
                 $this->write('');
 
                 return $value;