Send Errors to stderr - Script Builder in Visual Studio WinXP to build Solutions Files

To display an Error Summary for erroneous builds in bamboo build summary is not available for the Script Builder - going through the build logs seems tedious.
There is a section named "Error summary" which collects all errors during the build process that are printed to stderr. For example a build script

echo "ERROR build xyz failed" >&2

would print this message into the build summary section. It is up to you to insert the appropriate messages into your build script.


The actual problem is
not being very helpful: both build tools only append to stdout stream,
even in the case of warnings/errors during the build.


I solved the issue by writing a simple Ruby script that invokes the build tool and filters the stdout stream for any
warnings and errors via regexp; the matching warning/error lines are
then echoed to stderr and Bamboo picks them up nicely.

build script.ry

pipe = IO.popen(" #{$*[0]} /Rebuild ")
errors = 0
warnings = 0
while line = pipe.gets
if line =~ /^.* : .* error .*$/
$stderr.puts line
errors += 1
elsif line =~ /^.* : warning .*$/
$stderr.puts line
warnings += 1
$stdout.puts line
exit errors > 0 ? 1 : 0

Related Pages

Knowledge Base - (BSP-1381) Script Builder Display build errors in Error Summary

Last modified on Sep 28, 2017

Was this helpful?

Provide feedback about this article
Powered by Confluence and Scroll Viewport.