Redirect CppCheck output using command line build step fails

Hello

I would like to run cppcheck on our code as part of our build. However, I cannot make it save the output to a file using the command line build step.

From a regular (windows) command prompt the following works fine:

"C:\Program Files\Cppcheck\CppCheck.exe" --enable=all  --xml-version=2 "<full_path_with_spaces_to_source>" 2> cppcheck_result.xml

When runing the same from within TeamCity no output file is created! The check is performed and the normal output is seen in the build log, but somehow the 2> is lost. I am using TeamCity version 7.1.1.

I have searched everywhere I could think of,and the closest I could find was this:

http://superuser.com/questions/282140/redirect-7-zips-command-line-output-to-dev-null-on-windows-when-extracting-a-7

But this did not work for me, so any help would be greatly appreciated.

Alternatively, I you know of a better way to run cppcheck and get the results, please let me know.

Thanks,
Kim

2 comments
Comment actions Permalink

Hi Kim

Try to change the redirection syntax from 2> to just >
It should allow to write all tool's outbut to the file, not error messages.

0
Comment actions Permalink

Hi Michael,

Thank you for your reply. But unfortunately this does not work either. No file is created!

CppCheck will run with exit code 0. And I can see the output in the build log, but cannot save it into a file - which I want to keep as an artifact.

Best regards,
Kim

0

Please sign in to leave a comment.