Browse Source

Merge pull request #3094 from TomK/patch-1

read and discard zero chars to initialise STDIN
Jordi Boggiano 10 năm trước cách đây
mục cha
commit
32a9eebcd6
1 tập tin đã thay đổi với 1 bổ sung1 xóa
  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;