From 2a6587ff161d6a487e40912354e693b889ab93b9 Mon Sep 17 00:00:00 2001 From: Greg Anderson Date: Tue, 4 Jun 2019 15:21:49 -0700 Subject: [PATCH] Use posix_isatty if it is available. (#43) --- src/Util/Tty.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Util/Tty.php b/src/Util/Tty.php index b885731..4fcf4b4 100644 --- a/src/Util/Tty.php +++ b/src/Util/Tty.php @@ -15,6 +15,10 @@ class Tty */ public static function isTtySupported() { + // Start off by checking STDIN with `posix_isatty`, as that appears to be more reliable + if (function_exists('posix_isatty')) { + return posix_isatty(STDIN); + } if (method_exists('\Symfony\Component\Process\Process', 'isTtySupported')) { return Process::isTtySupported(); }