aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/remote_build.py17
1 files changed, 15 insertions, 2 deletions
diff --git a/scripts/remote_build.py b/scripts/remote_build.py
index e83f95d8d..756748853 100644
--- a/scripts/remote_build.py
+++ b/scripts/remote_build.py
@@ -6,10 +6,23 @@ from pathlib import Path
# {{{1 misc --------------------------------------------------------------------
+# Disables output of ANSI codes if the terminal doesn't support them
+if os.name == "nt":
+ from ctypes import windll, c_int, byref
+ stdout_handle = windll.kernel32.GetStdHandle(c_int(-11))
+ mode = c_int(0)
+ windll.kernel32.GetConsoleMode(c_int(stdout_handle), byref(mode))
+ ansi_on = (mode.value & 4) != 0
+else:
+ ansi_on = True
+
#-------------------------------------------------------------------------------
def _header(*args, ansi=96):
- print(f"\x1b[{ansi}m##", *args, end="")
- print("\x1b[0m")
+ if ansi_on:
+ print(f"\x1b[{ansi}m##", *args, end="")
+ print("\x1b[0m")
+ else:
+ print("\n##", *args)
#-------------------------------------------------------------------------------
def _run_checked(cmd, *args, **kwargs):