1
0
Fork 0

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.
pull/3094/head
Tom Kay 2014-07-05 13:49:45 +01:00
parent e77435cd0c
commit 526a4d7c9e
1 changed files with 1 additions and 1 deletions

View File

@ -177,7 +177,7 @@ class ConsoleIO extends BaseIO
// use bash if it's present // use bash if it's present
if ($finder->find('bash') && $finder->find('stty')) { if ($finder->find('bash') && $finder->find('stty')) {
$this->write($question, false); $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(''); $this->write('');
return $value; return $value;