Skip to content

Commit 2b181a6

Browse files
Fix terminal width detection: fallback to 85 if xterm-256color is undefined and suppress tput warnings
1 parent 42f576a commit 2b181a6

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Output/ConsoleOutput.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,11 @@ private function formatMessage(string $prefix, string $message, string $color):
363363

364364
private function geTerminalWidth(): int
365365
{
366-
return ((int)exec('tput cols') ?? 85 - 5);
366+
$width = 85;
367+
if (getenv('TERM')) {
368+
$width = ((int) @exec('tput cols') ?: $width);
369+
}
370+
return $width - 5;
367371
}
368372

369373
private function variableToString($variable): string

0 commit comments

Comments
 (0)