# Job fails even though the exit code is 0

**URL:** <https://travis-ci.community/t/job-fails-even-though-the-exit-code-is-0/7212>\
**Category:** Windows\
**Tags:** travis-build\
**Created:** [February 12, 2020, 1:19am UTC](https://travis-ci.community/t/job-fails-even-though-the-exit-code-is-0/7212 "2020-02-12T01:19:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kgriffs](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/kgriffs/32/3820_2.png) [@kgriffs](https://travis-ci.community/u/kgriffs)\
**Post date:** [February 12, 2020, 1:19am UTC](https://travis-ci.community/t/job-fails-even-though-the-exit-code-is-0/7212/1 "2020-02-12T01:19:37Z")

</div>

I’m working on adding a Windows job for the Falcon project but Travis always fails the job, even though the exit code is zero:

[https://travis-ci.org/falconry/falcon/builds/649228293](https://travis-ci.org/falconry/falcon/builds/649228293)

Here is a minimal travis config that I am working with:

```auto
language: python

dist: xenial

install: pip install tox
cache:
    directories:
        - $HOME/.cache/pip

matrix:
    include:
        - python: 3.8
          env: TOXENV=py38_windows
          os: windows
          language: shell
          before_install:
            - choco install python3 --params "/InstallDir:C:\\Python"
            - export PATH="/c/Python:/c/Python/Scripts:$PATH"
            - python -m pip install --upgrade pip wheel codecov

script: tox -- -v

```

Any ideas? Thanks in advance!

---

<div class="post-metadata">

**Author:** ![kgriffs](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/kgriffs/32/3820_2.png) [@kgriffs](https://travis-ci.community/u/kgriffs)\
**Post date:** [February 13, 2020, 4:25am UTC](https://travis-ci.community/t/job-fails-even-though-the-exit-code-is-0/7212/2 "2020-02-13T04:25:48Z")

</div>

I have been able to narrow this down to a subprocess that we spawn in one of the tests (via subprocess.Popen). When it does not exit cleanly and is forcefully terminated, this causes Travis CI to fail the job. Our test still passes in this particular case, and so it is unclear why Travis CI thinks the build failed.

---

<div class="post-metadata">

**Author:** ![kgriffs](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/kgriffs/32/3820_2.png) [@kgriffs](https://travis-ci.community/u/kgriffs)\
**Post date:** [February 14, 2020, 4:23am UTC](https://travis-ci.community/t/job-fails-even-though-the-exit-code-is-0/7212/3 "2020-02-14T04:23:01Z")

</div>

The fix that we settled on was to send SIGBREAK (CTRL+BREAK) to the process. SIGINT (CTRL+C) did not work on Travis, although it did seem to work on a desktop Windows box (this might be due to bash, but I can’t say for sure). The exit code for the process is still non-zero when using SIGBREAK to terminate it, but Travis seems to like this approach better for some reason vs. what we were doing before, and flags the job as having succeeded.

Regardless, it still seems like there is a bug in the job “succeeded/failed” logic used by Travis; IMO it should only depend on the exit code of the script command (in this case, tox).
