为什么不ang显示颜色输出下Scons? [英] Why doesn't clang show color output under Scons?

查看:139
本文介绍了为什么不ang显示颜色输出下Scons?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Scons构建时,我可以将其配置为使用俚语:

  env [CXX] = clang ++

但是,它似乎不保留clang输出的颜色信息。

根据 org / docs / UsersManual.html#formatting-of-diagnosticsrel =nofollow> clang documentation 时,仅在检测到具有颜色的终端时启用颜色 。 SCons不会自动将所有环境变量传递给运行编译器的进程,您已明确传递它们。



将以下内容添加到您的SConstruct中,颜色应该再次工作:

  import os 
env ['ENV'] ['TERM'] = os.environ ['TERM']


When building with Scons, I can configure it to use clang like so:

env["CXX"] = "clang++"

However, it doesn't seem to preserve the color information that clang outputs. How can I make scons preserve the color?

解决方案

According to the clang documentation, color is enabled only when a color-capable terminal is detected. SCons doesn't automatically pass on all environment variables to the process that runs the compiler, you have pass them explicitly. And TERM is not passed on to clang.

Add the following to your SConstruct and color should work again:

import os
env['ENV']['TERM'] = os.environ['TERM']

这篇关于为什么不ang显示颜色输出下Scons?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆