diff --git a/src/Symfony/Component/Console/Application.php b/src/Symfony/Component/Console/Application.php index 9dcafb3d21..9010fcae86 100644 --- a/src/Symfony/Component/Console/Application.php +++ b/src/Symfony/Component/Console/Application.php @@ -864,14 +864,16 @@ class Application implements ResetInterface if (true === $input->hasParameterOption(['--no-interaction', '-n'], true)) { $input->setInteractive(false); - } elseif (\function_exists('posix_isatty')) { + } else { $inputStream = null; if ($input instanceof StreamableInputInterface) { $inputStream = $input->getStream(); } - if (!@posix_isatty($inputStream) && false === getenv('SHELL_INTERACTIVE')) { + $inputStream = !$inputStream && \defined('STDIN') ? STDIN : $inputStream; + + if ((!$inputStream || !stream_isatty($inputStream)) && false === getenv('SHELL_INTERACTIVE')) { $input->setInteractive(false); } } diff --git a/src/Symfony/Component/Console/Output/StreamOutput.php b/src/Symfony/Component/Console/Output/StreamOutput.php index b7caa91382..6ffd9d1279 100644 --- a/src/Symfony/Component/Console/Output/StreamOutput.php +++ b/src/Symfony/Component/Console/Output/StreamOutput.php @@ -109,16 +109,6 @@ class StreamOutput extends Output || 'xterm' === getenv('TERM'); } - if (\function_exists('stream_isatty')) { - return @stream_isatty($this->stream); - } - - if (\function_exists('posix_isatty')) { - return @posix_isatty($this->stream); - } - - $stat = @fstat($this->stream); - // Check if formatted mode is S_IFCHR - return $stat ? 0020000 === ($stat['mode'] & 0170000) : false; + return stream_isatty($this->stream); } } diff --git a/src/Symfony/Component/VarDumper/Dumper/CliDumper.php b/src/Symfony/Component/VarDumper/Dumper/CliDumper.php index 207b716ea5..78290cdcc0 100644 --- a/src/Symfony/Component/VarDumper/Dumper/CliDumper.php +++ b/src/Symfony/Component/VarDumper/Dumper/CliDumper.php @@ -587,17 +587,7 @@ class CliDumper extends AbstractDumper || 'xterm' === getenv('TERM'); } - if (\function_exists('stream_isatty')) { - return @stream_isatty($stream); - } - - if (\function_exists('posix_isatty')) { - return @posix_isatty($stream); - } - - $stat = @fstat($stream); - // Check if formatted mode is S_IFCHR - return $stat ? 0020000 === ($stat['mode'] & 0170000) : false; + return stream_isatty($stream); } /**