Merge pull request #219 from francoispluchino/master

[BUG] Script error after enter password for the private repository
main
Jordi Boggiano 13 years ago
commit b005576d65

@ -103,7 +103,7 @@ abstract class FileDownloader implements DownloaderInterface
$ctx = stream_context_create($params);
stream_context_set_params($ctx, array("notification" => array($this, 'callbackGet')));
$this->io->overwrite(" Downloading: <comment>connection...</comment>");
$this->io->overwrite(" Downloading: <comment>connection...</comment>", false);
copy($url, $fileName, $ctx);
$this->io->overwrite(" Downloading");
@ -193,7 +193,7 @@ abstract class FileDownloader implements DownloaderInterface
}
if (0 === $progression % 5) {
$this->io->overwrite(" Downloading: <comment>$progression%</comment>");
$this->io->overwrite(" Downloading: <comment>$progression%</comment>", false);
}
}
break;

@ -65,7 +65,7 @@ class ConsoleIO implements IOInterface
/**
* {@inheritDoc}
*/
public function overwrite($messages, $size = 80, $newline = false)
public function overwrite($messages, $newline = true, $size = 80)
{
for ($place = $size; $place > 0; $place--) {
$this->write("\x08", false);
@ -124,16 +124,16 @@ class ConsoleIO implements IOInterface
. addslashes($question) . '", ""))');
$command = "cscript //nologo " . escapeshellarg($vbscript);
$this->write($question);
$this->write($question, false);
$value = rtrim(shell_exec($command));
unlink($vbscript);
for ($i = 0; $i < strlen($value); ++$i) {
$this->write('*');
$this->write('*', false);
}
$this->writeln('');
$this->write('');
return $value;
}
@ -142,22 +142,22 @@ class ConsoleIO implements IOInterface
if (rtrim(shell_exec($command)) === 'OK') {
$command = "/usr/bin/env bash -c 'echo OK'";
$this->write($question);
$this->write($question, false);
$command = "/usr/bin/env bash -c 'read -s mypassword && echo \$mypassword'";
$value = rtrim(shell_exec($command));
for ($i = 0; $i < strlen($value); ++$i) {
$this->write('*');
$this->write('*', false);
}
$this->writeln('');
$this->write('');
return $value;
}
// for other OS without shell_exec (does not hide the answer)
$this->writeln('');
$this->write('');
return $this->ask($question);
}

@ -38,10 +38,10 @@ interface IOInterface
* Overwrites a previous message to the output.
*
* @param string|array $messages The message as an array of lines or a single string
* @param integer $size The size of line
* @param Boolean $newline Whether to add a newline or not
* @param integer $size The size of line
*/
function overwrite($messages, $size = 80, $newline = true);
function overwrite($messages, $newline = true, $size = 80);
/**
* Asks a question to the user.

Loading…
Cancel
Save