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
v1 · 2026-09-28 · 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.

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) — more general patterns this builds on

  • 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 (35th 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-10-08

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).
  • Preserved source candidate: https://learn.microsoft.com/en-us/dotnet/csharp/fundamentals/program-structure/main-command-line
  • Preserved source candidate: https://doc.rust-lang.org/std/process/trait.Termination.html
  • Preserved source candidate: https://www.ibm.com/docs/en/zvm/7.4.0?topic=sc-return-codes
  • Preserved source candidate: http://www.antonis.de/dos/dos-tuts/mpdostip/html/nwdostip.htm
  • Preserved source candidate: https://web.archive.org/web/20161104235829/http://www.antonis.de/dos/dos-tuts/mpdostip/html/nwdostip.htm
  • Preserved source candidate: https://web.archive.org/web/20190601152204/https://www.sac.sk/download/text/mpdostip.zip
  • Preserved source candidate: http://www.antonis.de/dos/batchtut/battips/index.htm#7
  • Preserved source candidate: https://web.archive.org/web/20170823191411/http://www.antonis.de/dos/batchtut/battips/index.htm

The frozen Wikipedia revision is discovery provenance. The retained source set was reviewed for identity, formal or operational relation, and scope. The encyclopedia's structural synthesis is bounded to those claims; a thin authority surface is recorded as a nonblocking source-strengthening repair rather than concealed.