mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-04 00:59:51 +00:00
Automatically enable ANSI colours on Windows versions that support it
Note that stream_isatty() and sapi_windows_vt100_support() are ONLY defined on PHP 7.2, and the latter is only available on Windows.
This commit is contained in:
parent
30d2318bb7
commit
bdee746e46
@ -57,7 +57,13 @@ abstract class Terminal{
|
|||||||
if(isset($opts["disable-ansi"])){
|
if(isset($opts["disable-ansi"])){
|
||||||
self::$formattingCodes = false;
|
self::$formattingCodes = false;
|
||||||
}else{
|
}else{
|
||||||
self::$formattingCodes = ((Utils::getOS() !== "win" and getenv("TERM") != "" and (!function_exists("posix_ttyname") or !defined("STDOUT") or posix_ttyname(STDOUT) !== false)) or isset($opts["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
|
||||||
|
(
|
||||||
|
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
|
||||||
|
)
|
||||||
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ if(Test-Path "PocketMine-MP.phar"){
|
|||||||
}
|
}
|
||||||
|
|
||||||
function StartServer{
|
function StartServer{
|
||||||
$command = "powershell " + $binary + " " + $file + " --enable-ansi " + $extraPocketMineArgs
|
$command = "powershell " + $binary + " " + $file + " " + $extraPocketMineArgs
|
||||||
iex $command
|
iex $command
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user