Skip to content

Commit

Permalink
Merge pull request #14 from digiservnet/main
Browse files Browse the repository at this point in the history
Replace tput command as it's not available on all OSes
  • Loading branch information
jessarcher authored Jul 29, 2023
2 parents 3340cf4 + f80238b commit eeae4d7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Terminal.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace Laravel\Prompts;

use Symfony\Component\Console\Terminal as SymfonyTerminal;

class Terminal
{
/**
Expand Down Expand Up @@ -64,15 +66,15 @@ 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();
}

/**
* Get the number of lines in the terminal.
*/
public function lines(): int
{
return $this->lines ??= (int) shell_exec('tput lines 2>/dev/null');
return $this->lines ??= (new SymfonyTerminal())->getHeight();
}

/**
Expand Down

0 comments on commit eeae4d7

Please sign in to comment.