Skip to content

Instantly share code, notes, and snippets.

@jaytaph
Created November 4, 2015 08:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jaytaph/9a331f4ff6a116e7dc9e to your computer and use it in GitHub Desktop.
Save jaytaph/9a331f4ff6a116e7dc9e to your computer and use it in GitHub Desktop.
diff --git a/Helper/QuestionHelper.php b/Helper/QuestionHelper.php
index 3707ffe..781eff3 100644
--- a/Helper/QuestionHelper.php
+++ b/Helper/QuestionHelper.php
@@ -30,6 +30,7 @@ class QuestionHelper extends Helper
private $inputStream;
private static $shell;
private static $stty;
+ private $readlinePrompt;
/**
* Asks a question to the user.
@@ -172,7 +173,11 @@ class QuestionHelper extends Helper
$message = $question->getPrompt();
}
- $output->write($message);
+ if ($this->inputStream == STDIN && function_exists('readline')) {
+ $this->readlinePrompt = $message;
+ } else {
+ $output->write($message);
+ }
}
/**
@@ -438,7 +443,7 @@ class QuestionHelper extends Helper
private function readFromInput($stream)
{
if (STDIN === $stream && function_exists('readline')) {
- $ret = readline();
+ $ret = readline($this->readlinePrompt);
} else {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment