Fact-checked by Grok 2 weeks ago

Exit status

In , particularly in operating systems and POSIX-compliant environments, an exit status is a small non-negative value, typically limited to 8 bits (ranging from 0 to 255), that a terminated returns to its or calling program to indicate the outcome of its execution. This value is set via the exit() function or by returning from the main() function in a program, with 0 conventionally denoting successful completion and any non-zero value signaling an error, failure, or other specific condition. The is retrieved by the using system calls such as wait() and waitpid(), which provide the low-order 8 bits of the status, or waitid(), which provides the full status value, allowing macros like WIFEXITED() and WEXITSTATUS() to interpret whether the child exited normally and extract the exact code. In shell scripting and command-line environments, such as , the exit status of the last executed command is stored in the special variable $? and influences through constructs like if statements or the && and || operators, enabling error handling and automation. defines standard symbolic constants—EXIT_SUCCESS (0) for and EXIT_FAILURE (1) for general —while higher values (e.g., 2 for misuse of shell builtins or 126/127 for command not executable or not found) follow common Unix conventions, though exact meanings beyond 0 and 1 are implementation-specific and not universally standardized. This mechanism ensures reliable about execution results, forming a foundational element of management in modern operating s.

Fundamentals

Definition and Purpose

An is an value returned by a upon termination, providing a standardized way to indicate the result of its execution to the or caller. In POSIX-compliant systems, this value is conveyed using the low-order 8 bits of an , effectively limiting the portable to 0 to 255. The core purpose of an is to convey —conventionally represented by 0—or various or conditions through non-zero values, allowing processes, shells, or orchestrators to make informed decisions such as branching conditional logic, recording , or propagating termination signals. This facilitates robust handling in scripted or automated workflows by enabling the inspection of outcomes without direct . The mechanism traces its origins to early operating systems in the , exemplified by IBM's OS/360, where programs would set a return code in a designated (such as register 15) to signal job completion or errors to the , supporting sequential execution and basic fault detection. It evolved through the in multi-tasking environments to handle inter- coordination, becoming integral to hierarchies. A key principle is that the exit status remains associated with the specific terminating and is retrieved by the via system calls like wait(), which blocks until the child terminates and populates a status structure; the then uses macros such as WEXITSTATUS to extract the low-order 8 bits as the actual exit value. In systems, this supports the convention where signifies successful completion and non-zero values denote errors.

Common Conventions

In many computing systems, particularly those influenced by conventions, the exit status of a program or command is standardized as an 8-bit unsigned , ranging from 0 to 255, with values wrapping around 256 due to this bit limitation. This range ensures portability across implementations, as specified in the standard, which defines the exit status as the value returned by the wait() function's WEXITSTATUS macro. The ISO C standard similarly supports this by allowing exit() to accept an argument, typically interpreted within 0 to 255 for , though it does not explicitly mandate the range. A value of universally denotes successful completion or no , while any non-zero value indicates or an condition. Common error codes within this framework include 1 for general or catch-all , such as syntax errors or unexpected conditions in programs. In environments, exit code 2 signifies misuse of builtins, like invalid arguments to commands such as shift or break. Higher values like 126 indicate that a command was found but is not (e.g., due to permission issues), and 127 denotes that the command was not found at all. Best practices recommend that programs assign low numbers (typically 1 through 125) to specific, application-defined errors to promote clarity and , reserving higher values (126 through 255) for system- or shell-specific issues, such as signal terminations (often represented as 128 plus the signal number). This approach avoids conflicts with shell-reserved codes above 125, which may be used for special purposes like indicating fatal errors or invalid arguments. These conventions have evolved primarily through the influence of the (ISO/IEC 9899), which established macros like EXIT_SUCCESS (0) and EXIT_FAILURE (non-zero), and (IEEE Std 1003.1), which formalized the 0-255 range and special codes for shells and utilities, promoting widespread adoption across operating systems and programming environments.

Operating System Implementations

POSIX and Unix-like Systems

In -compliant systems and operating systems, the exit status of a process is defined as the low-order 8 bits of the status argument provided upon termination, forming an 8-bit unsigned integer value ranging from 0 to 255. This value is made available to the parent process through system calls that retrieve child process status. The standard convention interprets an exit status of 0 as indicating successful completion, while any non-zero value signifies failure or an error condition. In shell environments, the special parameter $? provides access to the exit status of the most recently executed foreground pipeline or command. This handling is formalized in the IEEE Std 1003.1 (POSIX.1) standard, which specifies the behavior in sections covering shell utilities like sh and system interfaces such as wait() and waitpid(). To retrieve the exit status from a child process, a parent uses waitpid() (or wait()), which stores the full status in an integer; if the child terminated normally, the WEXITSTATUS macro extracts the 8-bit exit value from this status word. When a terminates due to an uncaught signal, the status word returned by waitpid() encodes the signal rather than an exit value: the signal number is placed in the low-order 7 bits, with bit 7 set to indicate signal termination (resulting in a value of 128 + signal number in the low byte for querying via $? in shells). If a occurred, an additional flag (bit 7 of the low byte already set, with the core indication via WCOREDUMP) is included in the full status, though shell access via $? typically reflects only 128 + signal number without distinguishing the . Implementations remain consistent across major Unix-like variants, including , BSD derivatives (such as ), and macOS, all of which adhere to requirements for status encoding and retrieval. GNU-specific extensions in systems like further align with the 128 + signal convention for non-core-dump signal terminations in shell contexts.

Windows

In the Windows operating system, particularly under the kernel, the exit status of a is represented as a 32-bit unsigned integer (DWORD). This value is explicitly set when a process terminates using the ExitProcess function from the , which ends the calling process and all its threads, passing the specified exit code to the operating system. Developers can also retrieve this exit code post-termination via the GetExitCodeProcess function, which returns STILL_ACTIVE (259) if the process is running or the final DWORD otherwise. By convention in Windows applications and system components, an exit code of denotes successful completion, while any non-zero value indicates or an condition. Unlike some systems limited to 8 bits, the 32-bit DWORD allows for a vast range of distinct codes (0 to 4,294,967,295), enabling finer-grained error reporting without truncation. This flexibility supports the use of standardized error formats such as NTSTATUS (kernel-mode status codes) or HRESULT (user-mode structured exceptions), which encode detailed information within the 32 bits; for example, the HRESULT value 0x80070002 corresponds to the Win32 error "file not found" (ERROR_FILE_NOT_FOUND). Applications often reserve code 1 for generic errors when more specific diagnostics are unavailable. In interactive environments like the , the exit code from the previous command or program is stored in the %ERRORLEVEL% , which scripts and users can reference for error checking—much like the ? variable in [Unix-like](/page/Unix-like) shells. [PowerShell](/page/PowerShell) provides a parallel mechanism through the LASTEXITCODE automatic variable, which captures the exit code from the last external executable or native command invoked. Batch files commonly leverage %ERRORLEVEL% for conditional execution; the IF ERRORLEVEL n syntax evaluates to true if the current error level is greater than or equal to n, allowing branching logic such as IF ERRORLEVEL 1 [ECHO](/page/Echo) An error occurred to handle failures gracefully without halting the script. At the level, threads within a maintain individual exit codes set via ExitThread, retrievable using GetExitCodeThread even after termination. These thread-specific codes inform the 's overall state but do not directly override the exit code; instead, the termination status is finalized by the ExitProcess call from the primary or the return value from the 's (e.g., WinMain or main), aggregating thread outcomes into a single DWORD reported to the or system. This design ensures that multiprocess and multithreaded applications can propagate meaningful status information upward in the execution hierarchy.

DOS

In MS-DOS and compatible systems, programs terminate by invoking interrupt 21h with function 4Ch in the AH register, passing an 8-bit return code in the AL register to indicate the outcome of execution. This mechanism allows the operating system to return control to the , typically the COMMAND.COM shell, along with the specified code. The return code serves as a simple status indicator, enabling basic error handling in scripts and applications. The exit code is an unsigned 8-bit integer ranging from 0 to 255, where 0 conventionally signifies successful completion and non-zero values represent errors or abnormal termination. In tools such as DEBUG.COM, this value is often displayed in format as part of the AL register contents. Common error codes include 2 for "file not found," which may occur when attempting to access a non-existent file via system calls. Due to MS-DOS's single-tasking nature, exit codes are directly passed to the invoking instance without interference from concurrent processes, limiting their use to sequential execution flows. In batch files, the exit status from the most recent command or program is stored in the ERRORLEVEL pseudo-variable and can be tested using conditional IF statements, such as IF ERRORLEVEL 1 GOTO error_handler, which evaluates true if the code is 1 or higher. This syntax provides backward compatibility for scripting and remains functional in environments. The 8-bit DOS convention influenced early Windows implementations, including and 98 (collectively known as Win9x), which preserved ERRORLEVEL handling for DOS-compatible batch files. However, it was largely superseded in the kernel lineage by 32-bit exit codes retrievable via functions like GetExitCodeProcess, which return a full DWORD value for broader application needs.

AmigaOS

In , the exit status system employs a multi-level convention that provides graded feedback beyond simple success or failure, using predefined numeric values to indicate severity. The standard levels are 0 for success (OK), 5 for warnings (non-critical issues that allow continuation), 10 for errors (moderate problems that typically abort scripts unless overridden), and 20 for failures (critical issues that always terminate execution). These levels are based on AmigaDOS error codes, enabling programs and scripts to signal nuanced outcomes, such as recoverable cautions versus irrecoverable halts, which supports more robust error handling in multitasking environments. Programs set these exit statuses using the Exit() function from the dos.library, passing the desired code as an argument before termination, or in assembly by placing the value in register D0 upon exit. In scripting contexts, the QUIT command specifies a return code to propagate the status, while the RC environment variable captures the outcome of executed commands for conditional logic, such as with IF WARN to check for level 5. The FAILAT command further refines behavior by setting a threshold (e.g., FAILAT 15) above which scripts abort, allowing tolerance for warnings and minor errors. To query a child process's exit status, parents use synchronous calls like RunCommand() or System() with the WAIT flag, which return the child's code directly (0 for , 20 for FAIL, or -1 on launch failure). For asynchronous processes, notification occurs via the DeathMessage structure in NP_NotifyOnDeathMessage, providing the primary return code in dm_ReturnCode and a secondary error from IoErr() in dm_Result2; alternatively, the process header's pr_ReturnCode field holds the value post-termination. This system originated with AmigaDOS in 1.0, released in 1985, and has remained consistent through versions up to 4.x, influencing scripting in the environment where CLI commands underpin tool automation and batch operations. Examples include returning 5 for non-serious warnings, such as user confirmation prompts in scripts via the ASK command; 10 for moderate errors like invalid arguments; and 20 for critical failures, such as disk full conditions during file operations. These discrete levels pose portability challenges in cross-platform development, as they deviate from binary (0/non-zero) or broad-range (0-255) conventions in other systems, requiring conditional mapping in shared codebases.

OpenVMS

In , the exit status is represented by a 32-bit condition value that encodes detailed information about the outcome of program execution or system service calls. This value consists of a facility code in bits <27:16> identifying the originating component, such as the operating system or a specific run-time ; a message code in bits <15:3> specifying the particular within that facility; and severity bits in <2:0> indicating the overall impact of the . The structure allows for precise error reporting and handling, integrating seamlessly with the OpenVMS handling . Programs terminate and return an exit status using run-time library routines like LIBEXIT or system services like SYSEXIT, which pass the 32-bit condition value to the , calling image, or DCL command interpreter. LIBEXIT, part of the [OpenVMS](/page/OpenVMS) Run-Time Library ([RTL](/page/RTL)), accepts an unsigned longword status value and signals program completion, often used in application code for controlled exits. SYSEXIT similarly terminates the current image, returning the status in register R0 without further condition value arguments, enabling the status to propagate to higher-level environments like DCL procedures. Severity levels are encoded in the low-order bits of the condition value, providing a standardized way to classify outcomes: (1, indicating normal completion), warning (4, for non-fatal issues where the operation partially succeeded), (8, for recoverable failures), and fatal (12, for severe, unrecoverable errors that may compromise stability). These levels facilitate in scripts and handlers. For example, the generic condition SS$_NORMAL has a value of 1, with the success bit (<0>) set. To query exit statuses of processes, developers use the SYSGETJPI system service with item codes like JPI_EXIT_STATUS, which retrieves the final condition value for a terminated , or related items for ongoing across local or cluster-wide processes. In DCL scripting, the STATUS symbol automatically captures the 32-bit condition value after each command, allowing checks via IF statements—such as $IF $STATUS THEN for success (odd values) or $IF .NOT. $STATUS for failure (even values)—with $SEVERITY providing the extracted level for conditional branching. This condition value model has been a core feature since VMS version 1.0, released in October 1978, and integrates deeply with Record Management Services (RMS) for file I/O statuses and the RTL for broader application support, ensuring consistent error propagation across the system.

Plan 9

Plan 9, a distributed operating system developed at Bell Laboratories beginning in 1992, diverges from Unix conventions by representing exit status as an arbitrary text string rather than an integer value. This design choice aligns with the system's philosophy of treating all resources uniformly as files accessible via the 9P protocol, emphasizing simplicity and extensibility. Processes terminate using the exits system call, which accepts a character string message (up to ERRLEN bytes) describing the exit condition; a null or empty string denotes successful completion, while a non-empty string typically indicates an error or diagnostic information. The queries a child's exit status through the wait , which returns a Waitmsg structure containing the process ID, execution times, and the exit message—formatted as the process name, ID, and message if present—or via await, which populates a with the full text for parsing (e.g., using tokenize after appending a null terminator). Unhandled notes, Plan 9's equivalent to Unix signals, cause the to exit with a string prefixed by "suicide:" followed by the note name, such as "suicide: hangup" for a termination request. Unlike Unix systems, Plan 9 avoids core dumps, relying instead on the /proc for inspection and retrieval during . This string-based mechanism integrates seamlessly with Plan 9's distributed model, where namespaces span multiple machines via 9P-mounted file systems; exit statuses from remote processes remain accessible by mounting their /proc directories, enabling status propagation across the network without specialized inter-process communication primitives. Process creation with rfork inherits the parent's namespace and status handling, allowing lightweight forking while maintaining consistent access to exit information.

Programming Language Support

C Language

In the C programming language, the exit function, declared in the <stdlib.h> header, terminates the calling process and returns a status code to the host environment, allowing the program to communicate success or failure to the parent process or shell. According to the ISO C99 and C11 standards, the function signature is void exit(int status);, where the status argument is an integer whose value is passed unchanged to the environment, with conventional values of 0 or EXIT_SUCCESS indicating successful execution and any other value, such as EXIT_FAILURE, signaling an error. This mechanism provides a standardized way for C programs to end gracefully while preserving portability across compliant implementations. The _exit function, typically declared in <unistd.h> as part of POSIX extensions, offers a lower-level alternative to exit by immediately terminating the process without invoking cleanup operations, such as calling functions registered with atexit or flushing standard I/O buffers. In contrast, exit performs these cleanup steps before termination, ensuring that resources like open files are properly closed and any registered handlers are executed, which is essential for maintaining program integrity in most scenarios. Developers use _exit primarily in low-level contexts, such as after a fork to avoid unintended side effects in the child process. For portability, the ISO C99 and C11 standards define the status parameter as a full int, but many operating systems, including Unix-like systems, truncate it to the low-order 8 bits when propagating the value to the parent, limiting the effective range to 0–255. This truncation occurs at the OS level, so programs relying on values beyond 8 bits may behave inconsistently across platforms. When handling child processes created via fork, the C standard integrates with POSIX facilities through the <sys/wait.h> header, where the WEXITSTATUS macro extracts the 8-bit exit status from the overall status value returned by functions like wait. For instance, after wait(&status), applying WEXITSTATUS(status) yields the child's exit code if it terminated normally, enabling parent processes to inspect and respond to the child's outcome. A common example is the return statement in main, which implicitly behaves as if exit were called with the returned value; thus, return 0; in main signals successful completion equivalent to exit(0). This equivalence is mandated by the ISO C standards to simplify program termination. One limitation of C's exit status mechanism is the absence of direct encoding for signals or abnormal terminations within the status value itself, as it relies on the underlying OS to distinguish between normal exits and signal-induced deaths via separate status bits in wait results.

Java

In Java, the primary mechanism for terminating the (JVM) and specifying an exit status is the System.exit(int status) method, which immediately halts the currently running JVM and passes the provided integer status to the underlying operating system. This method invokes Runtime.getRuntime().exit(status) internally and does not return normally, ensuring abrupt termination after executing any registered shutdown hooks. The argument is an value, where 0 conventionally denotes successful execution and any non-zero value indicates failure or abnormal termination. Although uses a full 32-bit integer, the operating system receiving the status may truncate it—for instance, POSIX-compliant systems like Unix and limit exit codes to 8 bits (0–255), preserving only the least significant byte and interpreting negative values as 255 for -1. Uncaught exceptions in the main thread trigger the JVM's default uncaught exception handler, which prints the exception's to the stream and terminates the JVM with a non-zero status, typically 1. This behavior can be customized by implementing Thread.UncaughtExceptionHandler and setting it via Thread.setDefaultUncaughtExceptionHandler, allowing developers to log details or call System.exit with a tailored status before termination. If the public static void main(String[] args) method completes normally without throwing an exception, the JVM implicitly shuts down with an exit status of 0, as the last non-daemon thread has terminated successfully. The JVM provides portability by abstracting platform-specific exit mechanisms, mapping the Java status to the host OS's native conventions—such as the 8-bit limitation in environments—while maintaining consistent semantics across Windows, systems, and others. To intercept or modify behavior before exit, shutdown hooks can be registered using Runtime.addShutdownHook(Thread), which execute during the JVM's orderly shutdown sequence triggered by System.exit or normal completion. Java agents, via instrumentation, can further control exits.

Python

In Python, the primary mechanism for terminating a program with an exit status is the sys.exit([arg]) function from the sys module, which raises a SystemExit exception to allow for cleanup operations such as executing finally clauses in try-except blocks. The optional arg parameter defaults to None, which corresponds to an exit status of indicating successful termination; if provided as an integer, it sets the status directly (with for success and nonzero values, typically , for errors); non-integer arguments like strings are printed to standard error, and the program exits with status . This exception-based approach ensures that the exit status can be propagated while permitting and intervention. The SystemExit exception, a subclass of BaseException rather than Exception, is designed specifically for programmatic termination and is not caught by generic exception handlers unless explicitly targeted. If SystemExit is caught, the exception's argument can be inspected or modified to adjust the exit status before re-raising it or continuing execution. Unhandled SystemExit instances result in the interpreter exiting with the specified status without printing a traceback. In contrast, unhandled exceptions other than SystemExit (such as RuntimeError) cause the program to terminate with exit status 1, printing a full traceback to standard error for diagnostics. The exit status, when an integer, is passed directly to the operating system, adhering to conventions where 0 denotes success and 1 is used for most general errors, though values up to 127 are common to align with POSIX standards. For scenarios requiring immediate termination without cleanup—such as in multi-threaded or forked es— provides os._exit(n) in the os module, which bypasses , atexit callbacks, and buffer flushing to the directly with the integer status n. This function is particularly useful in scripting environments where partial execution might leave resources in an inconsistent state, analogous to low-level C functions like _exit. In the reference implementation, sys.[exit](/page/Exit) ultimately maps to the library's exit() function after handling the , ensuring the status is forwarded to the OS. Alternative implementations adapt accordingly: raises SystemExit but may invoke Java's System.exit() in certain contexts to terminate the JVM with the status, while IronPython similarly propagates the status to the .NET runtime's environment. Best practices recommend explicitly raising SystemExit(1) (or another appropriate status) for error conditions in scripts, as this leverages 's exception system for clarity and allows integration with try-except blocks without relying on function calls that might be intercepted. This approach has been supported since Python 2.5, released in 2006, enhancing portability and maintainability in modern codebases. For example, the following code demonstrates proper error exit:
python
import sys

try:
    # Some operation that might fail
    raise ValueError("Invalid input")
except ValueError:
    raise SystemExit(1)  # Explicit error exit
This pattern ensures the exit status reflects the program's outcome accurately while minimizing side effects.

Scripting and Automation

Shell Scripts

In shell scripting, particularly in POSIX-compliant shells like and extensions in , the exit status provides a mechanism for commands to communicate or to the script, enabling robust and error handling. The special parameter $? holds the exit status of the most recently executed command or , with a value of 0 indicating and any non-zero value signifying . Scripts propagate exit status to their parent process by default using the status of the last executed command, unless overridden by the exit builtin, which terminates the shell with a specified status n (an unsigned decimal integer between 0 and 255). If n is omitted, the script exits with the status of the prior command. For instance, exit 1 explicitly signals failure to the calling environment. Control flow in scripts often relies on exit status through conditional constructs. The if statement evaluates the exit status of a command list directly: if it is zero, the then branch executes; otherwise, the else branch may follow. Scripts can also query $? explicitly, as in if [ &#36;? -eq 0 ]; then echo "Success"; fi, to branch based on the previous command's outcome. This approach is fundamental for error checking in automation tasks. The builtin enhances exit status handling by intercepting signals, including the pseudo-signal , which triggers commands upon script termination regardless of the exit reason. Trap handlers can inspect or modify the exit status via $? before final propagation, such as logging errors or cleanup: trap 'echo "Exiting with status $?"' EXIT. This is particularly useful for ensuring resources are released even on abnormal termination. To propagate errors automatically, the set -e option (errexit) causes the to exit immediately upon any simple command or returning a non-zero status, unless the command is part of a conditional or . This mode, often enabled at the script's start with #!/bin/sh -e or set -e, simplifies handling in long scripts by halting execution on . In , the pipefail option addresses limitations in pipeline exit status propagation, where the default is the status of the last command only. When enabled via set -o pipefail, the 's status becomes the rightmost non-zero exit status (or 0 if all succeed), ensuring failures in earlier stages are not masked. For example:
set -o pipefail
false | true
echo $?  # Outputs 1, not 0
This promotes reliable error detection in chained commands. POSIX reserves exit status 127 for cases where a command is not found in the .

Batch and Command Scripts

In Windows batch files executed by , the exit status of the most recently run command or program is stored in the %ERRORLEVEL% , which holds a numeric value typically indicating (0) or (non-zero). This variable allows scripts to query the outcome of operations for conditional logic, evolving from early mechanisms where programs terminated via 21h (function 4Ch) to return an 8-bit code to the calling . In modern Windows environments, this integrates with the , preserving compatibility while supporting 32-bit integer values for broader error reporting. To terminate a batch script and set its exit status, the EXIT command is used: EXIT n ends the entire and returns code n to the , while EXIT /B n exits only the current subroutine (or the if not in a subroutine) without closing the session, leaving n as the new %ERRORLEVEL%. For example, a might end with EXIT /B 1 to signal failure from a subroutine, propagating the status for further checks. Conditional processing relies on the IF statement to evaluate %ERRORLEVEL%, such as IF %ERRORLEVEL% EQU 0 (echo Success) to execute a block only if the previous command succeeded exactly with code 0, or IF %ERRORLEVEL% NEQ 0 (echo Failure) for any . This exact-value checking distinguishes batch scripting from more flexible systems, requiring precise comparisons rather than ranges in basic usage. Batch scripts have limitations in handling exit statuses, particularly with pipelines (|), where %ERRORLEVEL% reflects only the exit code of the final command in the chain, discarding intermediate results unless explicitly captured via temporary variables or delayed expansion. Unlike some environments, batch files lack built-in signal trapping for interrupts, relying solely on polled codes post-execution. In PowerShell, which extends batch-like command scripting, the LASTEXITCODE automatic variable captures the exit code from the last external native program or script invocation, providing a direct analog to %ERRORLEVEL% for interoperability.[17] Additionally, the ? automatic variable offers a boolean view, evaluating to true if the prior command or pipeline succeeded (exit code 0) and false otherwise, simplifying success checks in scripts like if ($?) { Write-Output "Success" }. This dual approach enhances cross-platform scripting while maintaining Windows heritage.

References

  1. [1]
    exit
    The exit() function shall first call all functions registered by atexit(), in the reverse order of their registration.Missing: computing | Show results with:computing
  2. [2]
    wait
    ### Summary: Exit Status Provided to Parent Process
  3. [3]
    exit
    ### Summary of `exit` Utility in POSIX
  4. [4]
    wait
    ### Summary: How the Parent Process Obtains the Exit Status of the Child Process
  5. [5]
    Exit Status (Bash Reference Manual) - GNU.org
    The exit status of an executed command is the value returned by the waitpid system call or equivalent function. Exit statuses fall between 0 and 255.
  6. [6]
  7. [7]
    2. Shell Command Language
    Exit Status. The exit status of the if command shall be the exit status of the then or else compound-list that was executed, or zero, if none was executed.
  8. [8]
    exit - The Open Group Publications Catalog
    The exit() function shall then flush all open streams with unwritten buffered data, close all open streams, and remove all files created by tmpfile().
  9. [9]
    GNU Coding Standards
    Jul 5, 2025 · The GNU Coding Standards were written by Richard Stallman and other GNU Project volunteers. Their purpose is to make the GNU system clean, consistent, and easy ...
  10. [10]
  11. [11]
    sh
    ### Summary of Exit Status and $? in POSIX Shell
  12. [12]
    <sys/wait.h>
    ### Summary of Definitions from `<sys/wait.h>`
  13. [13]
    ExitProcess function (processthreadsapi.h) - Win32 apps
    Oct 31, 2022 · Use the GetExitCodeProcess function to retrieve the process's exit value. Use the GetExitCodeThread function to retrieve a thread's exit value.
  14. [14]
    System Error Codes (0-499) (WinError.h) - Win32 apps
    Jul 14, 2025 · The following list describes system error codes (errors 0 to 499). They are returned by the GetLastError function when many functions fail.Missing: bit
  15. [15]
    if - Microsoft Learn
    Feb 3, 2023 · Specifies that the command should be carried out only if the condition is false. errorlevel <number>, Specifies a true condition only if the ...
  16. [16]
    about_Automatic_Variables - PowerShell | Microsoft Learn
    Jan 7, 2025 · $LASTEXITCODE. Contains the exit code of the last native program or PowerShell script that ran. For PowerShell scripts, the value of $ ...
  17. [17]
    GetExitCodeThread function (processthreadsapi.h) - Win32 apps
    Feb 22, 2024 · Important The GetExitCodeThread function returns a valid error code defined by the application only after the thread terminates. Therefore ...
  18. [18]
    Terminating a Process - Win32 apps | Microsoft Learn
    Jul 14, 2025 · The GetExitCodeProcess function returns the termination status of a process. While a process is executing, its termination status is STILL_ACTIVE.
  19. [19]
    Int 21h Function 4Ch - Assembly Language Help - github
    The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. ... Input Output AH = 4Ch None AL = Return code -♢-
  20. [20]
    DOS Interrupts - IC-Unicamp
    MS-DOS ... MOV AH, 4Ch INT 21h. Load the return code (0 for normal exit, non-zero for error) into AL, then call the interrupt with function code 4Ch in AH.
  21. [21]
    MS-DOS Extended Errors - Computer Hope
    Jul 13, 2023 · MS-DOS extended errors ; 01, 01h, Function number invalid. ; 02, 02h, File not found. ; 03, 03h, Path not found. ; 04, 04h, Too many open tiles (no ...
  22. [22]
    DOS Exit Codes -- A Doctor DOS Discussion
    These provide a report after a command or utility has performed its operations that informs the user as to what took place.
  23. [23]
    Batch files - Errorlevels - Rob van der Woude's Scripting Pages
    Feb 10, 2025 · To check errorlevels during batch file development, use either COMMAND /Z yourbatch.bat to display the errorlevel of every command executed in ...
  24. [24]
    Errorlevel and Exit codes - Windows CMD - SS64
    There are two different methods of checking an errorlevel, the IF ERRORLEVEL command and the %ERRORLEVEL% system variable, the first method provides ...
  25. [25]
    GetExitCodeProcess function (processthreadsapi.h) - Win32 apps
    Nov 1, 2022 · The GetExitCodeProcess function returns a valid error code defined by the application only after the thread terminates.Missing: NT DWORD bit DOS
  26. [26]
    AmigaOS Manual: AmigaDOS Using Scripts
    Mar 13, 2014 · 10, Represents an error. A return code of 10 aborts a script, unless a higher limit has been set with the FAILAT command. ; 20, Represents a ...
  27. [27]
    AmigaOS Manual: AmigaDOS Command Reference
    The return code, normally 5, 10, or 20, indicates the severity of the error. A return code greater than or equal to a certain limit, the fail limit, terminates ...
  28. [28]
    Programming AmigaOS 4: DOS - The Data Administrator
    Jan 26, 2025 · You can simply replace them with exit() for the Runtime library. You ... VOID Exit(LONG returnCode); -> exit() VOID VFWritef(BPTR fh ...<|control11|><|separator|>
  29. [29]
    dos.doc.txt - AmigaOS Documentation Wiki
    RETURN CODES Most AmigaDOS functions and some return codes have undergone major changes and rewrites over the last decade or so. This brings about issues ...
  30. [30]
    AmigaOS version history - Wikipedia
    A new version of AmigaOS was released on December 24, 2006, after five years of development by Hyperion Entertainment (Belgium) under license from Amiga, Inc. ...Kickstart/Workbench 1.0, 1.1, 1... · AmigaOS 3.5, 3.9 · AmigaOS 4
  31. [31]
    AmigaOS Manual: AmigaDOS Error Messages
    Dec 25, 2020 · This appendix lists AmigaDOS errors with their probable causes and suggestions for recovery. These error messages are the output from the system when your ...
  32. [32]
    VSI OpenVMS Calling Standard — VMS Software, Inc.
    OpenVMS software components return condition values when they complete execution. ... exit the program image with the condition value as the final image status.
  33. [33]
    RTL Library (LIB$) Manual — VMS Software, Inc.
    This manual documents the library routines contained in the LIB$ and CVT$ facilities of the OpenVMS Run-Time Library.the section called “Guidelines... · the section called “Exceptions...
  34. [34]
    System Services Reference Manual: GETUTC–Z - VMS Software
    If passed by value on OpenVMS Alpha, a 32-bit virtual address is actually a 64-bit address that is sign-extended from 32 bits.
  35. [35]
    $$GETJPI - VSI OpenVMS Wiki
    Nov 14, 2019 · SYS$GETJPI, or Get Job/Process Information, is a system service that returns information about one or more processes on the system or across the OpenVMS ...
  36. [36]
  37. [37]
    Architectures - VSI OpenVMS Wiki - VMS Software
    Jul 11, 2025 · Releases ; V1.0, 25 October 1978, VAX-11/780 ; VAX/VMS Version 1.5, February 1979, VAX-11/780 ; V2.0, April 1980, VAX-11/750 ; V3.0, April 1982, VAX ...
  38. [38]
    [PDF] VSI OpenVMS Record Management Services Reference Manual
    $$RMSDEF gives you the names of the condition values returned by RMS. See the OpenVMS system messages documentation for a list of all RMS status codes. ... RTL ...
  39. [39]
    Plan 9 /sys/man/2/exits
    ### Summary of `exits` Function from https://9p.io/magic/man2html/2/exits
  40. [40]
    [PDF] Plan 9 from Bell Labs - MIT CSAIL Computer Systems Security Group
    Plan 9 from Bell Labs. Rob Pike. Dave Presotto. Sean Dorward. Bob Flandrena. Ken ... This paper serves as an overview of the system. It discusses the ...
  41. [41]
    Plan 9 /sys/man/2/wait
    ### Summary of wait Status Return in Plan 9
  42. [42]
    Plan 9 /sys/man/2/notify
    ### Summary: How Signals or Notes Affect Exit Status in Plan 9
  43. [43]
  44. [44]
  45. [45]
  46. [46]
    Process.exitValue() only returns the low byte of the exit code?
    Apr 26, 2013 · Unix and Linux only support an 8-bit exit code. The top-order 8 bits are reserved for a signal indication. Marked as Answer by User731477 ...Missing: status POSIX
  47. [47]
    Why does Java exit with success after an uncaught exception?
    Nov 22, 2010 · The java command in Java 6 and Java 7 both seem to respond with a non-zero exit code if an uncaught exception is raised.java - The best way to handle exceptions?Java Exception Error Enumerations Anti-patternMore results from softwareengineering.stackexchange.com
  48. [48]
    Exit status returned by Java utility - Oracle Forums
    Jul 9, 2010 · This is an exit code of 1, when the JVM exits due to an uncaught exception. I did this under cygwin on Windows, and I don't know how to check ...
  49. [49]
  50. [50]
  51. [51]
  52. [52]
  53. [53]
    26.1. sys — System-specific parameters and functions - Jython
    exit("some error message") is a quick way to exit a program when an error occurs. sys.exitfunc. This value is not actually defined by the module, but can be set ...
  54. [54]
    27.1. sys — System-specific parameters and functions
    The optional argument arg can be an integer giving the exit status (defaulting to zero), or another type of object. If it is an integer, zero is considered “ ...
  55. [55]
  56. [56]
  57. [57]
  58. [58]
  59. [59]
  60. [60]
  61. [61]
    The MS-DOS Encyclopedia: Section V: System Calls - PCjs Machines
    If control returns to COMMAND.COM, the return code can be tested with an ERRORLEVEL statement in a batch file. ... int 21h ; Ask MS-DOS to return code. cbw ; ...
  62. [62]
    exit | Microsoft Learn
    Nov 1, 2024 · If /b is specified, the ERRORLEVEL environment variable is set to that number. If you are quitting the command interpreter, the process exit ...
  63. [63]
    Exit - Terminate a script - Windows CMD - SS64.com
    Exiting nested FOR loops, EXIT /b can be used to exit a FOR loop that is nested within another FOR loop. This will only work if the inner FOR loop is contained ...