From 4976ea5b7407d4bd48d363062b2b56fd5c946a89 Mon Sep 17 00:00:00 2001 From: Joe Parsons Date: Fri, 14 Feb 2020 13:57:58 -0700 Subject: [PATCH] Addresses #131. Added check to see if TTY is available. --- src/Command/CheckCommand.php | 3 ++- src/Util/Tty.php | 28 ++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 src/Util/Tty.php diff --git a/src/Command/CheckCommand.php b/src/Command/CheckCommand.php index 7222c0c..c953d36 100644 --- a/src/Command/CheckCommand.php +++ b/src/Command/CheckCommand.php @@ -2,6 +2,7 @@ namespace DrupalCheck\Command; +use DrupalCheck\Util\Tty; use DrupalFinder\DrupalFinder; use Nette\Neon\Neon; use PHPStan\ShouldNotHappenException; @@ -211,7 +212,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $command = array_merge($command, $paths); $process = new Process($command); - $process->setTty(true); + $process->setTty(Tty::isTtySupported()); $process->setTimeout(null); $process->run(static function ($type, $buffer) use ($output) { if (Process::ERR === $type) { diff --git a/src/Util/Tty.php b/src/Util/Tty.php new file mode 100644 index 0000000..e217ce8 --- /dev/null +++ b/src/Util/Tty.php @@ -0,0 +1,28 @@ +/dev/null', array(array('file', '/dev/tty', 'r'), array('file', '/dev/tty', 'w'), array('file', '/dev/tty', 'w')), $pipes); + } +}