From 91d3303a563ca8ceb7285d81fc98b00b173d5d5a Mon Sep 17 00:00:00 2001 From: Mark van Duijker Date: Tue, 1 Oct 2024 22:35:41 +0200 Subject: [PATCH] Correctly set the tty on build and install commands --- src/Commands/BuildCommand.php | 3 ++- src/Commands/InstallCommand.php | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Commands/BuildCommand.php b/src/Commands/BuildCommand.php index 2b4539a..1c8bdfa 100644 --- a/src/Commands/BuildCommand.php +++ b/src/Commands/BuildCommand.php @@ -6,6 +6,7 @@ use Illuminate\Support\Facades\File; use Illuminate\Support\Facades\Process; use Tonysm\TailwindCss\Manifest; +use Symfony\Component\Process\Process as SymfonyProcess; class BuildCommand extends Command { @@ -48,7 +49,7 @@ public function handle() } Process::forever() - ->tty(PHP_OS != 'WINNT' && is_writable('/dev/tty')) + ->tty(SymfonyProcess::isTtySupported()) ->path(base_path()) ->run(array_filter([ $binFile, diff --git a/src/Commands/InstallCommand.php b/src/Commands/InstallCommand.php index a8b00c7..204ba19 100644 --- a/src/Commands/InstallCommand.php +++ b/src/Commands/InstallCommand.php @@ -7,6 +7,7 @@ use Illuminate\Support\Facades\Process; use Illuminate\Support\Str; use Symfony\Component\Process\PhpExecutableFinder; +use Symfony\Component\Process\Process as SymfonyProcess; use Tonysm\TailwindCss\Actions\AppendTailwindTag; class InstallCommand extends Command @@ -53,7 +54,7 @@ private function ensureTailwindConfigExists() private function ensureTailwindCliBinaryExists() { if (! File::exists(config('tailwindcss.bin_path')) || $this->option('download')) { - Process::forever()->tty(PHP_OS != 'WINNT' && is_writable('/dev/tty'))->run([ + Process::forever()->tty(SymfonyProcess::isTtySupported())->run([ $this->phpBinary(), 'artisan', 'tailwindcss:download', @@ -168,7 +169,7 @@ private function addIngoreLines() private function runFirstBuild() { - Process::forever()->tty(PHP_OS != 'WINNT' && is_writable('/dev/tty'))->run([ + Process::forever()->tty(SymfonyProcess::isTtySupported())->run([ $this->phpBinary(), 'artisan', 'tailwindcss:build',