Skip to content

Commit fbb9df8

Browse files
author
Amrouche Hamza
committed
bugfix: the terminal state was wrong and not reseted
1 parent d45ecef commit fbb9df8

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/Symfony/Component/Console/Helper/QuestionHelper.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@ private function autocomplete(OutputInterface $output, Question $question, $inpu
254254

255255
// as opposed to fgets(), fread() returns an empty string when the stream content is empty, not false.
256256
if (false === $c || ('' === $ret && '' === $c && null === $question->getDefault())) {
257+
shell_exec(sprintf('stty %s', $sttyMode));
257258
throw new RuntimeException('Aborted.');
258259
} elseif ("\177" === $c) { // Backspace Character
259260
if (0 === $numMatches && 0 !== $i) {

src/Symfony/Component/Console/Tester/CommandTester.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,15 @@ public function execute(array $input, array $options = [])
6868
if (isset($options['interactive'])) {
6969
$this->input->setInteractive($options['interactive']);
7070
}
71-
7271
$this->output = new StreamOutput(fopen('php://memory', 'w', false));
7372
$this->output->setDecorated(isset($options['decorated']) ? $options['decorated'] : false);
7473
if (isset($options['verbosity'])) {
7574
$this->output->setVerbosity($options['verbosity']);
7675
}
76+
$this->statusCode = $this->command->run($this->input, $this->output);
77+
fclose($this->input->getStream());
7778

78-
return $this->statusCode = $this->command->run($this->input, $this->output);
79+
return $this->statusCode;
7980
}
8081

8182
/**

src/Symfony/Component/Console/Tests/Tester/CommandTesterTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,6 @@ public function testCommandWithWrongInputsNumber()
159159
$helper->ask($input, $output, new Question($questions[1]));
160160
$helper->ask($input, $output, new Question($questions[2]));
161161
});
162-
163162
$tester = new CommandTester($command);
164163
$tester->setInputs(['a', 'Bobby', 'Fine']);
165164
$tester->execute([]);
@@ -186,7 +185,6 @@ public function testCommandWithQuestionsButNoInputs()
186185
$helper->ask($input, $output, new Question($questions[1]));
187186
$helper->ask($input, $output, new Question($questions[2]));
188187
});
189-
190188
$tester = new CommandTester($command);
191189
$tester->execute([]);
192190
}

0 commit comments

Comments
 (0)