merged branch lenar/input-isatty (PR #1699)
Commits -------fd00ed0
[Console] Check if dialog helper actually exists0f7bf41
[Console] Detect if interactive mode is possible at all Discussion ---------- [Console] Detect if interactive mode is possible at all --------------------------------------------------------------------------- by fabpot at 2011/07/19 22:52:14 -0700 You can use the dialog helper without a tty (think unit tests). see https://github.com/sensio/SensioGeneratorBundle/blob/master/Tests/Command/GenerateDoctrineCrudCommandTest.php#L24 --------------------------------------------------------------------------- by lenar at 2011/07/25 06:18:48 -0700 @fabpot: this change doesn't prevent those tests from running (and successfully so). Please reconsider including. --------------------------------------------------------------------------- by lenar at 2011/07/27 01:30:20 -0700 Rebased.
This commit is contained in:
commit
f53297681a
@ -170,6 +170,13 @@ class Application
|
||||
$input->setInteractive(false);
|
||||
}
|
||||
|
||||
if (function_exists('posix_isatty') && $this->getHelperSet()->has('dialog')) {
|
||||
$inputStream = $this->getHelperSet()->get('dialog')->getInputStream();
|
||||
if (!posix_isatty($inputStream)) {
|
||||
$input->setInteractive(false);
|
||||
}
|
||||
}
|
||||
|
||||
if (true === $input->hasParameterOption(array('--quiet', '-q'))) {
|
||||
$output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
|
||||
} elseif (true === $input->hasParameterOption(array('--verbose', '-v'))) {
|
||||
|
@ -117,6 +117,16 @@ class DialogHelper extends Helper
|
||||
$this->inputStream = $stream;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the helper's input stream
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getInputStream()
|
||||
{
|
||||
return $this->inputStream;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the helper's canonical name
|
||||
*/
|
||||
|
Reference in New Issue
Block a user