[Console] Detect if interactive mode is possible at all
This commit is contained in:
parent
d171d39b5d
commit
0f7bf4155c
@ -170,6 +170,13 @@ class Application
|
||||
$input->setInteractive(false);
|
||||
}
|
||||
|
||||
if (function_exists('posix_isatty')) {
|
||||
$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