Jenkins + Python + MSBuild =没有ANSI颜色 [英] Jenkins + Python + MSBuild = No ANSI Colors

查看:771
本文介绍了Jenkins + Python + MSBuild =没有ANSI颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

短:

如何获取从Jenkins运行的MSBuild的颜色。

Short:
How can I get colors for MSBuild running from Jenkins.

长:

我有一个好的Python构建脚本,使用pyColors模块将漂亮的输出打印到控制台。当我从CMD运行脚本时,我从我的脚本和颜色从MSBuild(例如:蓝色为完成建设项目,绿色为构建成功,红色的错误)。

我也从Jenkins运行相同的脚本(当然在Windows上)。在乞讨,我没有颜色在Jenkins日志(控制台输出)。然后,我安装了ANSIColor插件,现在我只获得由Python脚本生成的颜色,但没有来自MSBuild的颜色。

我试图调查它从GitHub的MSBuild项目,我发现MSBuild有一些安全尝试/ ctach检查设置颜色,这可能是失败(BaseConsoleLogger.cs行455)。我认为Python模块只是打印原始的ANSI转义字符,而Win32 API设置颜色失败时,控制台输出重定向。

Long:
I have a nice Python build script that uses the pyColors module to print pretty output to console. When I'm running the script from CMD, I get colors from my script and colors from MSBuild (Ex: Blue color for "Done Building Project", Green for "Build succeeded", Red for errors).
I also run the same script from Jenkins (on Windows, of course). At the begging I got no colors in the Jenkins log (Console output). I then, installed the ANSIColor plugin, and now I only get the colors generated by the Python script, but no colors from MSBuild.
I tried to investigate it from the MSBuild project on GitHub, and I found that MSBuild has some safety try/ctach check on setting colors, that is probably failing (BaseConsoleLogger.cs line 455). I think that the Python module is simply printing raw ANSI escape characters, while the Win32 API for setting colors is failing when the console output is redirected.

PS

我在Windows 8上使用完全更新的Jenkins Visual Studio 2015 SP1

P.S.
I'm using fully updated Jenkins on Windows 8 with Visual Studio 2015 SP1

推荐答案

大的成功,我的pull请求现在合并到MSBuild项目。 https://github.com/Microsoft/msbuild/commit/58350c52d6e397fe90a7a48bcf46d4dda8023510
我正在寻找将是可能的下一个版本的Visual Studio使用/ forceConsoleColor

Big success, my pull request is now merged into the MSBuild project. https://github.com/Microsoft/msbuild/commit/58350c52d6e397fe90a7a48bcf46d4dda8023510 What I was looking for will be possible with the next release of Visual Studio using /forceConsoleColor

这篇关于Jenkins + Python + MSBuild =没有ANSI颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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