mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-11 22:15:30 +00:00
Terminal::hasFormattingCodes() workaround for STDOUT not being defined
#1979 This isn't a full solution because formatting codes are still not applied correctly if the calling thread doesn't inherit classes.
This commit is contained in:
parent
d2d1df0447
commit
c601816586
@ -57,13 +57,15 @@ abstract class Terminal{
|
|||||||
if(isset($opts["disable-ansi"])){
|
if(isset($opts["disable-ansi"])){
|
||||||
self::$formattingCodes = false;
|
self::$formattingCodes = false;
|
||||||
}else{
|
}else{
|
||||||
|
$stdout = fopen("php://stdout", "w");
|
||||||
self::$formattingCodes = (isset($opts["enable-ansi"]) or ( //user explicitly told us to enable ANSI
|
self::$formattingCodes = (isset($opts["enable-ansi"]) or ( //user explicitly told us to enable ANSI
|
||||||
stream_isatty(STDOUT) and //STDOUT isn't being piped
|
stream_isatty($stdout) and //STDOUT isn't being piped
|
||||||
(
|
(
|
||||||
getenv('TERM') !== false or //Console says it supports colours
|
getenv('TERM') !== false or //Console says it supports colours
|
||||||
(function_exists('sapi_windows_vt100_support') and sapi_windows_vt100_support(STDOUT)) //we're on windows and have vt100 support
|
(function_exists('sapi_windows_vt100_support') and sapi_windows_vt100_support($stdout)) //we're on windows and have vt100 support
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
|
fclose($stdout);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user