# Travis CI: calling exit in script kills the cache upload

## TL;DR

On Travis CI, never call exit in your script phase if you want caching (or anything after script) to run. It kills the worker immediately; let the script finish normally so the cache stage executes. Context: From a Travis CI community forum thread, resolved by the reporter.

Use this when you run into the situation in the title.

**When not to use this skill:** unrelated tasks. It covers only the procedure above.

## Compatibility

The steps above apply to the commands named in them. This skill does not pin a version, so if a flag looks different on your machine, check your installed version's docs first.

## Details

A Maven build completed successfully but the local repository was never cached. The cause: the build script called exit, which terminated the worker before the cache-upload stage ran. Removing the exit call fixed caching. Anything that ends the worker early, even on success, skips the stages after script.
