diff --git a/src/Symfony/Component/Console/Application.php b/src/Symfony/Component/Console/Application.php index fc30e460e9b15..9e4dd2d80dc5e 100644 --- a/src/Symfony/Component/Console/Application.php +++ b/src/Symfony/Component/Console/Application.php @@ -170,6 +170,13 @@ public function doRun(InputInterface $input, OutputInterface $output) $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'))) { diff --git a/src/Symfony/Component/Console/Helper/DialogHelper.php b/src/Symfony/Component/Console/Helper/DialogHelper.php index 8d73addcf0e1a..c1dd5813e6aac 100644 --- a/src/Symfony/Component/Console/Helper/DialogHelper.php +++ b/src/Symfony/Component/Console/Helper/DialogHelper.php @@ -117,6 +117,16 @@ public function setInputStream($stream) $this->inputStream = $stream; } + /** + * Returns the helper's input stream + * + * @return string + */ + public function getInputStream() + { + return $this->inputStream; + } + /** * Returns the helper's canonical name */