diff --git a/src/Terminal.php b/src/Terminal.php index 7bde554e..e060da08 100644 --- a/src/Terminal.php +++ b/src/Terminal.php @@ -2,6 +2,8 @@ namespace Laravel\Prompts; +use Symfony\Component\Console\Terminal as SymfonyTerminal; + class Terminal { /** @@ -64,7 +66,7 @@ public function restoreTty(): void */ public function cols(): int { - return $this->cols ??= (int) shell_exec('tput cols 2>/dev/null'); + return $this->cols ??= (new SymfonyTerminal())->getWidth(); } /** @@ -72,7 +74,7 @@ public function cols(): int */ public function lines(): int { - return $this->lines ??= (int) shell_exec('tput lines 2>/dev/null'); + return $this->lines ??= (new SymfonyTerminal())->getHeight(); } /**