main
Smasty 12 years ago
parent bd83eb93bf
commit 58f0d4aeac

@ -164,13 +164,13 @@ class ConsoleIO implements IOInterface
// handle other OSs with bash/zsh/ksh/csh if available to hide the answer // handle other OSs with bash/zsh/ksh/csh if available to hide the answer
$test = "/usr/bin/env %s -c 'echo OK' 2> /dev/null"; $test = "/usr/bin/env %s -c 'echo OK' 2> /dev/null";
foreach(array('bash', 'zsh', 'ksh', 'csh') as $sh){ foreach (array('bash', 'zsh', 'ksh', 'csh') as $sh) {
if('OK' === rtrim(shell_exec(sprintf($test, $sh)))){ if ('OK' === rtrim(shell_exec(sprintf($test, $sh)))) {
$shell = $sh; $shell = $sh;
break; break;
} }
} }
if(isset($shell)){ if (isset($shell)) {
$this->write($question, false); $this->write($question, false);
$readCmd = ($shell === 'csh') ? 'set mypassword = $<' : 'read mypassword'; $readCmd = ($shell === 'csh') ? 'set mypassword = $<' : 'read mypassword';
$command = sprintf("/usr/bin/env %s -c 'stty -echo; %s; stty echo; echo \$mypassword'", $shell, $readCmd); $command = sprintf("/usr/bin/env %s -c 'stty -echo; %s; stty echo; echo \$mypassword'", $shell, $readCmd);

Loading…
Cancel
Save