3 Commits
1.1.0 ... 1.1.1

Author SHA1 Message Date
sunxyw
1b7e343493 Merge pull request #7 from zhamao-robot/fix-no-terminal-size-without-io
修復无交互环境下无法获取终端尺寸
2023-03-09 23:41:10 +08:00
sunxyw
97ee152121 update version 2023-03-09 23:40:30 +08:00
sunxyw
11156c65a2 fix no terminal size without io 2023-03-09 22:41:30 +08:00
2 changed files with 7 additions and 2 deletions

View File

@@ -10,7 +10,7 @@ use Psr\Log\LogLevel;
class ConsoleLogger extends AbstractLogger
{
public const VERSION = '1.1.0';
public const VERSION = '1.1.1';
/**
* 日志输出格式

View File

@@ -237,7 +237,12 @@ class TablePrinter
}
} else {
$size = exec('stty size 2>/dev/null');
$size = (int) explode(' ', trim($size))[1];
// in case stty is not available
if (empty($size)) {
$size = 0;
} else {
$size = (int) explode(' ', trim($size))[1];
}
}
if (empty($size)) {
return $this->terminal_size = 79;