Exit code
An exit code is a numeric status returned by a process when it terminates to indicate the outcome of its execution.
Tiny Python Projects: Learn coding and testing with puzzles and games
An error code is a numeric process exit status indicating that a program terminated because an error occurred.
- How it is used
- Coordinates command-line error reporting, validation, testing, shell redirection, and pipeline control.
- How deep it goes
- Explains zero versus nonzero statuses, sys.exit() forms, STDERR routing, validation branches, and status assertions, but not operating-system status internals.
- Examples
- Demonstrates invalid arguments, missing placeholders, STDERR redirection, explicit sys.exit(1), string-based sys.exit(), and nonzero-status tests.
- What you can do after
- Apply it via Python's sys.exit() and argparse to report failures, separate diagnostics, stop pipelines, and test error behavior.
Read how Tiny Python Projects: Learn coding and testing with puzzles and games explains exit code →
Kubernetes in Action, Second Edition
An exit code is a numeric result returned by a process when it terminates, conventionally indicating success or failure.
- How it is used
- Uses process results to evaluate container health and interpret container termination during Kubernetes lifecycle operations.
- How deep it goes
- Explains zero, non-zero, 128+n, 137, and 143 codes, then applies them to probes, restarts, signals, and logs.
- Examples
- Demonstrates exit code 0 after graceful termination, code 137 after killing, and command results from an exec liveness probe.
- What you can do after
- Diagnose/debug with it by inspecting pod status, interpreting termination codes, and retrieving logs from the previous container.
Read how Kubernetes in Action, Second Edition explains exit code →
Also covered in
- Crack Any Codebase with AIIn early access (MEAP)
- Bootstrapping Microservices, Second Edition: With Docker, Kubernetes, GitHub Actions, and Terraform
- Kubernetes for Developers
- Practical Automation with PowerShell: Effective scripting from the console to the cloud
- GitHub Actions in Action: Continuous integration and delivery for DevOps
- Learn PowerShell Scripting in a Month of Lunches, Second Edition: Write and organize scripts and tools
What to know first
- command-line argumentA command-line argument is a value or option supplied to a program when it is invoked, providing input or affecting its behavior.
Related concepts
- sys.exitproduced by · sys.exit is a Python function that terminates program execution by raising a SystemExit exception with an optional exit status or message.
- software testingproduced by · Software testing is the systematic evaluation of software under specified inputs or conditions to assess its behavior against expected results or requirements and identify defects.
- parser.error()produced by · parser.error() is an argparse parser method that reports a command-line parsing error, displays usage information, and terminates the program with a failure status.
Questions about exit code
What is exit code?
An exit code is a numeric status returned by a process when it terminates to indicate the outcome of its execution.
Which Manning books explain exit code?
Tiny Python Projects: Learn coding and testing with puzzles and games and Kubernetes in Action, Second Edition.
What should I know before learning exit code?
Manning books that teach exit code usually introduce command-line argument first.
What kinds of exit code are there?
Kinds of exit code include last exit code.
What is exit code also called?
Exit code is also called return code.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

