False Build Fail Status

trevor.sandy's Avatar


21 Nov, 2017 12:00 PM

Very strange. My builds are running to completion - including build check; yet AppVeyor status is build failed.

This behaviour is present on two of my repos. The first one executing Qt/MinGW/MSYS2 32 and 64bit builds in a single job - using a script to set the env accordingly.

The second repo is executing a C++ solution on MSBuild using the VS2017 image.

These are the last few lines of the first repo's build log:

-build.cmd finished.
Command executed with exception: ldglgui.c:1693:29: warning: parameter 'obj' set but not used [-Wunused-but-set-parameter]
 void handleupdir(muiObject *obj, enum muiReturnValue value)

'-build.cmd finished. is the last line of my batch script. If we get there the build was successful. However, you can see AV is reporting 'Command executed with exception ...' - a benign warning.

On the second repo, the build log shows different output but the same behaviour - terminating with build fail status but the build and check were completed successfully. Here are the last lines of the 2nd repo's output:

--Build check cleanup...
-autobuild.cmd finished.
Command executed with exception:  Max Level: 5/5

Thank you in advance.

  1. Support Staff 1 Posted by Feodor Fitsner on 21 Nov, 2017 07:19 PM

    Feodor Fitsner's Avatar

    Hi Trevor,

    To me it looks like PS (PowerShell) mode is used to run build scripts/commands. Could you drop your appveyor.yml please (export it to YAML if configured on UI)?

  2. 2 Posted by trevor.sandy on 21 Nov, 2017 08:45 PM

    trevor.sandy's Avatar

    Hello Feodor,

    Many thanks for the fast reply! I'm not sure I fully understand your request to 'drop' my appveyor.yml. If you mean to post it or provide a link (it's in GitHub), here they are:

    Repo1 appveyor.yml

    Repo2 appveyor.yml

    Yes, I'm using PS, accessing both bash (WSL, and MSYS), and cmd.exe. This is working flawlessly on my local dev env.

    A little background. My appveyor.yml files are a bit detailed because they build and package image renderers (there are 3 of them) which are consumed by my main application (LPub3D). Across all the packages, I am using MSVS, Qt, MSYS2 (for Qt 64bit on Windows) and GCC of course as all packages are C++. The goal is to build the entire suite from source so my cloud CI solution is tailored to be as efficient as possible - an ongoing process. To this end, I'm using batch scripts to drive the core build process for each renderer (2 of which are showing false fails) while my appveyor.yml is mostly using PS to access other shells.

    FYI, I imagine you are aware it is possible to click on the git sha for the appveyor build and go directly to the source repository for that commit. Just in case you are interested to see the build scripts. For repo 1 the script is at the root dir ./build.cmd, for repo 2 it is at ./windows/vs2017/autobuild.cmd.

    Many thanks!

  3. Support Staff 3 Posted by Feodor Fitsner on 22 Nov, 2017 01:44 AM

    Feodor Fitsner's Avatar

    OK, the problem is in - ps: prefix. When the command writes to StdErr it's treated by PowerShell as exception thus the build fails. You can try either use - cmd: prefix or put build PS script into some file inside the repo and then use - cmd: powershell .\your_build_script.ps1. Alternatively, you can try playing with StdErr redirection in PS (kind of 2>&1 at the end of command), but it's not always work. Or, you can try modifying your PS script to make the last command succeed, something like Write-Host "Success!". Hope that helps.

  4. 4 Posted by trevor.sandy on 22 Nov, 2017 03:13 AM

    trevor.sandy's Avatar

    Excellent ! Problem solved.

    I opted to go with StdErr redirect manipulation - e.g:

    cmd.exe /c build.com -all `>log.txt 2`>`&1

    When I call cmd.exe /c... it will be possible to redirect to a log then display or just redirect to StdErr, StdOut.

    Repo1 ran to completion without any red paint or abend. Thanks again.

    Note: the backquotes keep PS from parsing the redirect characters.


  5. Support Staff 5 Posted by Feodor Fitsner on 22 Nov, 2017 03:23 AM

    Feodor Fitsner's Avatar

    Nice, thanks for sharing the solution!

  6. 6 Posted by E. M. Bray on 25 Jul, 2018 03:32 PM

    E. M. Bray's Avatar

    FWIW a solution I have used successfully if you still want to report a build failure on a non-zero return code, but otherwise want to ensure success (even if there were messages to stderr) is to do something like:

    if ($LASTEXITCODE -eq 0) {
  7. Ilya Finkelshteyn closed this discussion on 27 Aug, 2018 06:19 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

Recent Discussions

21 Aug, 2019 11:06 PM
21 Aug, 2019 02:08 PM
21 Aug, 2019 01:37 PM
21 Aug, 2019 10:21 AM
21 Aug, 2019 09:10 AM


21 Aug, 2019 05:56 AM
21 Aug, 2019 03:08 AM
20 Aug, 2019 11:33 PM
20 Aug, 2019 08:07 PM
20 Aug, 2019 05:50 PM
20 Aug, 2019 12:35 PM