diff --git a/src/Symfony/Component/Console/Helper/QuestionHelper.php b/src/Symfony/Component/Console/Helper/QuestionHelper.php index 9c200fe897ea9..b722ee4b8843c 100644 --- a/src/Symfony/Component/Console/Helper/QuestionHelper.php +++ b/src/Symfony/Component/Console/Helper/QuestionHelper.php @@ -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) { diff --git a/src/Symfony/Component/Console/Tester/CommandTester.php b/src/Symfony/Component/Console/Tester/CommandTester.php index a1d8ad70a1248..8204261961a26 100644 --- a/src/Symfony/Component/Console/Tester/CommandTester.php +++ b/src/Symfony/Component/Console/Tester/CommandTester.php @@ -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; } /** diff --git a/src/Symfony/Component/Console/Tests/Tester/CommandTesterTest.php b/src/Symfony/Component/Console/Tests/Tester/CommandTesterTest.php index f916b1821fcc8..788c1bde7e11e 100644 --- a/src/Symfony/Component/Console/Tests/Tester/CommandTesterTest.php +++ b/src/Symfony/Component/Console/Tests/Tester/CommandTesterTest.php @@ -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([]); @@ -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([]); }