Explorar o código

Don't polute output in Windows console with colours, which it doesn't support

Yentl Van Tendeloo %!s(int64=9) %!d(string=hai) anos
pai
achega
a3cc3ba6bf
Modificáronse 1 ficheiros con 8 adicións e 2 borrados
  1. 8 2
      scripts/prompt.py

+ 8 - 2
scripts/prompt.py

@@ -5,10 +5,16 @@ import subprocess
 import os
 
 def local_print(string):
-    print("\033[92m%s\033[0m" % string)
+    if os.name == "posix":
+        # Nicer colour output when using posix (and thus supporting colour)
+        string = "\033[92m%s\033[0m" % string
+    print(string)
 
 def remote_print(string):
-    print("\033[94m%s\033[0m" % string)
+    if os.name == "posix":
+        # Nicer colour output when using posix (and thus supporting colour)
+        string = "\033[94m%s\033[0m" % string
+    print(string)
 
 local_print("Welcome to the local shell!")
 local_print("Please specify Modelverse location (default: localhost:8001)")