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.
main
Tom Kay 10 years ago
parent e77435cd0c
commit 526a4d7c9e

@ -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;

Loading…
Cancel
Save