Kaynağa Gözat

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 10 yıl önce
ebeveyn
işleme
526a4d7c9e
1 değiştirilmiş dosya ile 1 ekleme ve 1 silme
  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;