Promptles
Automation & Scripting

Exit Code

intermediate

Definition

A number a program returns when it finishes to signal whether it succeeded or failed. An exit code of 0 means success; any other number means something went wrong. Scripts and pipelines use exit codes to decide whether to continue or stop.

In the wild

If 'npm test' exits with code 0, your CI pipeline knows tests passed and moves on to deployment. If it exits with code 1, the pipeline stops and reports a failure. You can check the last exit code in a shell with 'echo $?'.

More from Automation & Scripting