Skip to content

Commit

Permalink
bug #30883 [Console] Fix stty not reset when aborting in QuestionHelp…
Browse files Browse the repository at this point in the history
…er::autocomplete() (Simperfit)

This PR was merged into the 3.4 branch.

Discussion
----------

[Console] Fix stty not reset when aborting in QuestionHelper::autocomplete()

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no <!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- don't forget to update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | #30861   <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | none

<!--
Write a short README entry for your feature/bugfix here (replace this comment block.)
This will help people understand your PR and can be used as a start of the Doc PR.
Additionally:
 - Bug fixes must be submitted against the lowest branch where they apply
   (lowest branches are regularly merged to upper ones so they get the fixes too).
 - Features and deprecations must be submitted against the master branch.
-->

Commits
-------

f54389b bugfix: the terminal state was wrong and not reseted
  • Loading branch information
fabpot committed Apr 6, 2019
2 parents 0c8e8a5 + f54389b commit d77ea48
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/Symfony/Component/Console/Helper/QuestionHelper.php
Expand Up @@ -260,6 +260,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

0 comments on commit d77ea48

Please sign in to comment.