Skip to content

Commit

Permalink
bugfix: the terminal state was wrong and not reseted
Browse files Browse the repository at this point in the history
  • Loading branch information
Amrouche Hamza committed Apr 6, 2019
1 parent d45ecef commit fbb9df8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/Symfony/Component/Console/Helper/QuestionHelper.php
Expand Up @@ -254,6 +254,7 @@ private function autocomplete(OutputInterface $output, Question $question, $inpu

// as opposed to fgets(), fread() returns an empty string when the stream content is empty, not false.
if (false === $c || ('' === $ret && '' === $c && null === $question->getDefault())) {
shell_exec(sprintf('stty %s', $sttyMode));
throw new RuntimeException('Aborted.');
} elseif ("\177" === $c) { // Backspace Character
if (0 === $numMatches && 0 !== $i) {
Expand Down
5 changes: 3 additions & 2 deletions src/Symfony/Component/Console/Tester/CommandTester.php
Expand Up @@ -68,14 +68,15 @@ public function execute(array $input, array $options = [])
if (isset($options['interactive'])) {
$this->input->setInteractive($options['interactive']);
}

$this->output = new StreamOutput(fopen('php://memory', 'w', false));
$this->output->setDecorated(isset($options['decorated']) ? $options['decorated'] : false);
if (isset($options['verbosity'])) {
$this->output->setVerbosity($options['verbosity']);
}
$this->statusCode = $this->command->run($this->input, $this->output);
fclose($this->input->getStream());

return $this->statusCode = $this->command->run($this->input, $this->output);
return $this->statusCode;
}

/**
Expand Down
Expand Up @@ -159,7 +159,6 @@ public function testCommandWithWrongInputsNumber()
$helper->ask($input, $output, new Question($questions[1]));
$helper->ask($input, $output, new Question($questions[2]));
});

$tester = new CommandTester($command);
$tester->setInputs(['a', 'Bobby', 'Fine']);
$tester->execute([]);
Expand All @@ -186,7 +185,6 @@ public function testCommandWithQuestionsButNoInputs()
$helper->ask($input, $output, new Question($questions[1]));
$helper->ask($input, $output, new Question($questions[2]));
});

$tester = new CommandTester($command);
$tester->execute([]);
}
Expand Down

0 comments on commit fbb9df8

Please sign in to comment.