8000 Moved question prompt to readline() function by jaytaph · Pull Request #16458 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

Moved question prompt to readline() function #16458

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
8000
Diff view
Diff view
Next Next commit
Moved question prompt to readline() function
  • Loading branch information
jaytaph committed Nov 4, 2015
commit 98d8c6db3dbc1719b6e6c78e19bbfbc90b461704
9 changes: 7 additions & 2 deletions src/Symfony/Component/Console/Helper/QuestionHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class QuestionHelper extends Helper
private $inputStream;
private static $shell;
private static $stty;
private $readlinePrompt;

/**
* Asks a question to the user.
Expand Down Expand Up @@ -172,7 +173,11 @@ protected function writePrompt(OutputInterface $output, Question $question)
$message = $question->getPrompt();
}

$output->write($message);
if ($this->inputStream == STDIN && function_exists('readline')) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be strict (===) comparison and yoda (see 440 line).

$this->readlinePrompt = $message;
} else {
$output->write($message);
}
}

/**
Expand Down Expand Up @@ -438,7 +443,7 @@ private function getShell()
private function readFromInput($stream)
{
if (STDIN === $stream && function_exists('readline')) {
$ret = readline();
$ret = readline($this->readlinePrompt);
} else {
$ret = fgets($stream, 4096);
}
Expand Down
0