Support ASCI control

Windows CMD prompt does not automatically support ASCI color control
characters on the console from Python. Enable this behavior by
accessing the current console and allowing the interpreation of ASCI
control characters from Python via the win32 API.
This commit is contained in:
John Parent
2022-11-30 18:45:06 -05:00
committed by Peter Scheibel
parent 288e728144
commit 9f0bb4301f
2 changed files with 62 additions and 0 deletions

View File

@@ -605,6 +605,10 @@ def setup_main_options(args):
for config_var in args.config_vars or []:
spack.config.add(fullpath=config_var, scope="command_line")
# On Windows10 console handling for ASCI/VT100 sequences is not
# on by default. Turn on before we try to write to console
# with color
color.try_enable_terminal_color_on_windows()
# when to use color (takes always, auto, or never)
color.set_color_when(args.color)