mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-13 17:29:44 +00:00
Better Terminal detection
This commit is contained in:
parent
ac4194eb3f
commit
fe55023761
@ -55,7 +55,7 @@ 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") !== "") or isset($opts["enable-ansi"]));
|
self::$formattingCodes = ((Utils::getOS() !== "win" and getenv("TERM") != "" and (!function_exists("posix_ttyname") or posix_ttyname(STDOUT) !== false)) or isset($opts["enable-ansi"]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,6 +129,10 @@ abstract class Terminal{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static function init(){
|
public static function init(){
|
||||||
|
if(!self::hasFormattingCodes()){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
switch(Utils::getOS()){
|
switch(Utils::getOS()){
|
||||||
case "linux":
|
case "linux":
|
||||||
case "mac":
|
case "mac":
|
||||||
@ -138,9 +142,7 @@ abstract class Terminal{
|
|||||||
|
|
||||||
case "win":
|
case "win":
|
||||||
case "android":
|
case "android":
|
||||||
if(self::hasFormattingCodes()){
|
|
||||||
self::getFallbackEscapeCodes();
|
self::getFallbackEscapeCodes();
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user