QamoosTech
DevOps & CloudCommand lineBeginnerPython

Exit Code

PronunciationEG-zit kohd

Definition

An exit code is the number a program returns to the shell when it finishes. 0 means success and any other number means some kind of failure.

Where you hear it

In scripts (&& chains), CI pipelines that go red, and CLI tools that need to signal errors.

Examples

  • The tests failed, so the command exits with code 1 and CI stops.
  • Call sys.exit(2) when the arguments are invalid.
  • The deploy script exits with code 0 only when every health check passes.

Common mistake

Printing an error message but still exiting with 0. Scripts and CI will think everything worked.

Don't confuse with

The output text, which a human reads. The exit code is the machine-readable result.

Say it at work

  • In a meeting or chatCheck the exit code before continuing.
  • In an email or ticketWhy did it exit with 137?