How to fail a build on Gitlab CI shell runner
<p>I have a Gitlab CI runner running on windows 10:</p>

<pre><code>before_script:
  - "echo off"
  - 'call "%VS120COMNTOOLS%\vsvars32.bat"'
  - echo.
  - set
  - echo.

stages:
  - build

build:
  stage: build
  script:
  - 'StatusTest.exe'
  #- msbuild...
</code></pre>

<p>I am trying to fail the build with StatusText.exe (I tried returning status codes -1,0,1; throwing an exception, etc.) But Runner only logs the exception and continues with following steps.</p>

<p>What determines that CI shell runner should fail the build and not proceed to next step?</p>

<p>Output:</p>

<pre><code>...
windows_tracing_logfile=C:\BVTBin\Tests\installpackage\csilogfile.log
$ echo.

$ StatusTest.exe

Unhandled Exception: System.Exception: tralala
   at StatusTest.Program.Main(String[] args)
$ echo "Restoring NuGet Packages..."
...
</code></pre>