Skip to content

Exit Status

A small value produced when a process terminates and made available to its parent or caller to summarize whether and, by convention, how the execution completed.

Version
v2 · 2026-11-14 · History
Domain-specific #
9353
Domain group
Applied Sciences & Engineering
Origin domain
Computer Science & Software Engineering
Subdomains
Operating Systems, Shell Programming → Computer Science & Software Engineering
Aliases
Exit Code, Exit Value, Return Code, Errorlevel

Core Idea

Exit status turns termination into a machine-readable control signal. It is deliberately small and out-of-band from ordinary program output so callers can branch without parsing prose.

The number has no universal detailed meaning. Correct use requires the producer's code table, the operating system's termination encoding, and the caller's rules for pipelines, signals, and wrappers.

How would you explain it like I'm…

The Goodbye Number

When a computer program finishes its job, it holds up a little number card, like a thumbs-up or thumbs-down. Other programs look at the card to decide what to do next, without reading a long note. But what each number means depends on the program that held it up. You have to check that program's own list of meanings.

A Program's Finish Signal

When a program ends, it hands back a small number called its Exit Status. This number is separate from whatever the program printed on the screen. Other programs can check it quickly to decide what to do next, without reading through text. Often 0 means things went fine, but the other numbers don't have one meaning everywhere. To understand them, you need that program's own list of codes. You also need to know how the computer reports things like a program being stopped.

Machine-Readable Termination Code

An Exit Status is a small integer a program returns when it terminates. It turns "how did it end?" into a signal another program can act on. It travels separately from the program's normal output, so a calling script can branch on success or failure without parsing text. There is no universal detailed meaning for each number. The producing program defines its own code table. The operating system also has rules for how termination is encoded, such as when a program is killed by a signal instead of exiting normally. Shells and wrappers add their own rules too, for example about which command's status a pipeline reports. To interpret an Exit Status correctly, you need all three of these pieces.

 

An Exit Status is the small integer a process returns on termination, converting the fact and manner of termination into a machine-readable control signal. It travels out-of-band from stdout and stderr, so callers such as shells and build tools can branch on it without parsing prose output. Beyond broad conventions, the value has no universal detailed meaning. Interpreting it requires three pieces of context: the producer's own code table, the operating system's termination encoding (which distinguishes normal exit from termination by a signal), and the caller's rules. Those rules matter in pipelines, where a shell must decide which stage's status represents the whole, and with wrapper programs that may pass through, remap, or replace the inner status.

Structural Signature

Sig role-phrases:

  • Terminating process — Chooses or yields the completion code. It is producer. Counterfactual: Abnormal termination may substitute system status.
  • Runtime or operating system — Transports and preserves termination information. It is channel. Counterfactual: Bit width and encoding are platform dependent.
  • Parent or caller — Retrieves the result after termination. It is consumer. Counterfactual: An unobserved code has no control effect.
  • Program convention — Maps numeric values to meanings. It is semantics. Counterfactual: The same integer can mean different things for different commands.
  • Shell or orchestrator — Branches, reports, retries, or composes commands from status. It is control use. Counterfactual: Boolean shell treatment can discard detailed meanings.
  • Termination mode — Distinguishes normal exit from signal, exception, or forced kill. It is qualifier. Counterfactual: Collapsing modes can misdiagnose failure.

What It Is Not

  • It is not the program's printed error message.
  • It is not universally an errno value.
  • Nonzero details are program-specific.
  • A wrapper can hide the child process's original status.
  • Closest near-miss. A signal number or wait status can encode why a process ended; the exit status is the conventional completion value extracted or reported by the platform.

Scope of Application

  • Shell scripting. Controls conditional and pipeline execution.
  • Process supervision. Detects failure and selects restart policy.
  • Build and CI systems. Summarizes command completion.
  • Command design. Publishes stable automation contracts.

Clarity

State producer, lifecycle boundary, normal or abnormal termination, full raw wait result, extracted exit code, width and range, zero convention, code table, pipeline policy, wrapper behavior, retry semantics, and where richer diagnostics are stored.

Manages Complexity

One integer sits between program-specific failure taxonomies and platform-specific process semantics. Composition through shells, containers, remote execution, and supervisors can silently transform which code is observed.

Abstract Reasoning

  1. Identify the exact process whose completion matters.
  2. Separate normal exit code from signal or exception termination.
  3. Retrieve status without overwriting it in an intervening command.
  4. Interpret it using the executable's documented contract and platform rules.
  5. Preserve raw status and diagnostic context when wrappers, pipelines, or retries transform control flow.

Knowledge Transfer

Compact completion signaling transfers to jobs and workflow steps, but numeric codes and termination modes remain runtime-specific. HTTP responses and language exceptions are neighboring protocols, not process exit statuses.

Examples

Canonical

A validation command exits 0 when all files pass, 2 for malformed input, and 3 for policy failures; a CI runner waits, records the raw code, and applies that published table.

Mapped back: producer → validator; codes → 0, 2, 3; transport → process wait; consumer → CI runner; semantics → published table.

Applied / In Practice

Printing 'ERROR 3' to stderr and then exiting 0 produces an error message but not exit status 3.

Mapped back: stderr → ERROR 3; actual exit → 0; caller view → success code; verdict → text is not status.

Structural Tensions

T1 — Compact Automation versus Diagnostic Richness. A few bits support reliable branching but cannot carry full failure context.

Diagnostic: Which detail belongs in logs or structured output?

T2 — Portable Convention versus Program Specificity. Zero/nonzero travels widely while detailed code tables and widths vary.

Diagnostic: What assumptions survive across shells and operating systems?

Structural–Framed Character

Exit Status is structural as a termination-bound completion value and framed by operating-system process control.

Structural Core vs. Domain Accent

The general pattern is a compact outcome signal crossing a control boundary. Computing adds processes, wait semantics, shells, signals, code widths, and automation conventions.

This entry presupposes Interface.

  • Approved process-control root. No frozen parent entails the termination-value contract between a process and caller.

  • Related — return value, errno, signal, wait status, standard error, and HTTP status. They carry other results or diagnostics and must not be conflated.

Relationships to Other Abstractions

Local relationship map for Exit StatusParents appear above the current abstraction, mutual partners to the right, and children below. Node labels state whether each abstraction is prime or domain-specific; colors identify relation types.Exit StatusDOMAINPrime abstraction: Interface — presupposesInterfacePRIME

Current abstraction Exit Status Domain-specific

Parents (1) — outgoing typed relations

  • Exit Status presupposes Interface Prime

    Exit Status presupposes Interface: the parent's defining role is necessary to the child's frozen mechanism or criterion.

Hierarchy path (1) — routes to 1 parentless root

Neighborhood in Abstraction Space

Exit Status sits in a crowded region of the domain-specific corpus (32nd percentile for distinctiveness): several abstractions share nearly its structure, so a description that fits it tends to fit its neighbors too.

Family — Computer Systems & Network Architecture (20 abstractions)

Nearest neighbors

Computed from structural-signature embeddings · 2026-11-14

Not to Be Confused With

  • Function return value. Tell: Returns within a process and may never become its exit code.
  • Error number. Tell: Identifies a runtime or library error under another convention.
  • Termination signal. Tell: Describes abnormal ending rather than a normal chosen code.
  • Standard error. Tell: Is a byte stream, not the caller's completion value.

References

  • Frozen Wikipedia discovery revision: https://en.wikipedia.org/wiki/Exit_status (revision 1364497423).