Skip to content

Commit 9db2be2

Browse files
author
whitequark
committedFeb 22, 2016
compiler: only use colors in diagnostics on POSIX (fixes #272).
1 parent 4946a53 commit 9db2be2

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed
 

‎artiq/compiler/testbench/signature.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def process_diagnostic(diag):
1414
else:
1515
diag = False
1616
def process_diagnostic(diag):
17-
print("\n".join(diag.render(colored=True)))
17+
print("\n".join(diag.render(colored=False)))
1818
if diag.level in ("fatal", "error"):
1919
exit(1)
2020

‎artiq/coredevice/core.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,10 @@ def shorten_path(path):
2222
lines = [shorten_path(path) for path in diagnostic.render(colored=colored)]
2323
return "\n".join(lines)
2424

25+
colors_supported = (os.name == 'posix')
2526
class _DiagnosticEngine(diagnostic.Engine):
2627
def render_diagnostic(self, diagnostic):
27-
sys.stderr.write(_render_diagnostic(diagnostic, colored=True) + "\n")
28+
sys.stderr.write(_render_diagnostic(diagnostic, colored=colors_supported) + "\n")
2829

2930
class CompileError(Exception):
3031
def __init__(self, diagnostic):
@@ -33,7 +34,7 @@ def __init__(self, diagnostic):
3334
def __str__(self):
3435
# Prepend a newline so that the message shows up on after
3536
# exception class name printed by Python.
36-
return "\n" + _render_diagnostic(self.diagnostic, colored=True)
37+
return "\n" + _render_diagnostic(self.diagnostic, colored=colors_supported)
3738

3839

3940
@syscall

0 commit comments

Comments
 (0)
Please sign in to comment.