mirror of
https://github.com/zhamao-robot/zhamao-logger.git
synced 2026-03-17 20:44:52 +08:00
Merge pull request #7 from zhamao-robot/fix-no-terminal-size-without-io
修復无交互环境下无法获取终端尺寸
This commit is contained in:
commit
1b7e343493
@ -10,7 +10,7 @@ use Psr\Log\LogLevel;
|
||||
|
||||
class ConsoleLogger extends AbstractLogger
|
||||
{
|
||||
public const VERSION = '1.1.0';
|
||||
public const VERSION = '1.1.1';
|
||||
|
||||
/**
|
||||
* 日志输出格式
|
||||
|
||||
@ -237,8 +237,13 @@ class TablePrinter
|
||||
}
|
||||
} else {
|
||||
$size = exec('stty size 2>/dev/null');
|
||||
// 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;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user