开发者

Rake - failing builds for warnings

I am trying to automate our build system and one of the task is to fail the builds if a warnings is thrown in the compiler.

we are using sh rake command to compile.

How one can fail on warnings, is there any way i can capture the开发者_如何学运维 output from compiler to a buffer and do a pattern search?

Thanks, Prabhu


For anyone who stumbles on this question and is wondering the same thing you want to look into something like the ruby module Open3.

This "grants you access to stdin, stdout, stderr" and as such would allow you to detect when a build fails... for instance:

def runcommand(cmdLine)
  stdout, stderr, status = Open3.capture3(cmdLine)
  fail "Build Failed\n#{stderr}" unless status.success?
end
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜