Skip to content

Exit Code

John edited this page Sep 4, 2019 · 2 revisions

An Exit code (or Return code) is a number that is returned by the Operating System when a program exits (terminates). This article contains information about several aspects of exit codes.

Exit codes are used in a variety of situations in PC². For example, the CLICS Validator returns an exit code of 42 (indicating "Yes/Accepted/Passed Validation") or 43 (indicating "No/Failed Validation"). Any other exit code from a CLICS Validator is considered a system error.

Unix exit codes

In Unix-like systems, the current value of the exit code can be displayed as follows:

echo *?

Note that this prints the exit code for the command immediately preceding the echo command. For example:

 $ foo
 $ echo $?
 42
 $ echo $?
 0

Windows/DOS

The "exit code" in a Windows-based system, referred to as the error level, can be displayed as follows:

echo %ERRORLEVEL%

Note that this prints the exit code for the command immediately preceding the echo.

PC2 Logo

Clone this wiki locally