[Console] Detect if interactive mode is possible at all

This commit is contained in:
lenar 2011-07-15 00:10:14 +03:00
parent d171d39b5d
commit 0f7bf4155c
2 changed files with 17 additions and 0 deletions

View File

@ -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'))) {

View File

@ -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
*/