Module: TTY::Exit::Code

Defined in:
lib/tty/exit/code.rb

Overview

All reserved exit codes as constants

Constant Summary collapse

SUCCESS =

No errors

0
ERROR =

Catchall for general errors

1
SHELL_MISUSE =

Missing keyword or command, or permission problem (and diff return code on a failed binary file comparison).

2
BASE =

The start base code to reduce possibility of clashing with other exit statuses that programs may already run.

64
USAGE_ERROR =

The command was used incorrectly, e.g., with the wrong number of arguments, a bad flag, a bad syntax in a parameter, or whatever.

BASE
DATA_ERROR =

The input data was incorrect in some way. This should only be used for user’s data & not system files.

BASE + 1
NO_INPUT =

An input file (not a system file) did not exist or was not readable.

BASE + 2
NO_USER =

The user specified did not exist. This might be used for mail addresses or remote logins.

BASE + 3
NO_HOST =

The host specified did not exist. This is used in mail addresses or network requests.

BASE + 4
SERVICE_UNAVAILABLE =

A service is unavailable. This can occur if a support program or file does not exist. This can also be used as a catchall message when something you wanted to do doesn’t work, but you don’t know why.

BASE + 5
SOFTWARE_ERROR =

An internal software error has been detected. This should be limited to non-operating system related errors as possible.

BASE + 6
SYSTEM_ERROR =

An operating system error has been detected. This is intended to be used for such things as “cannot fork”, “cannot create pipe”, or the like. It includes things like getuid returning a user that does not exist in the passwd file.

BASE + 7
SYSTEM_FILE_MISSING =

Some system file (e.g., /etc/passwd, /etc/utmp, etc.) does not exist, cannot be opened, or has some sort of error (e.g., syntax error).

BASE + 8
CANT_CREATE =

A (user specified) output file cannot be created.

BASE + 9
IO_ERROR =

An error occurred while doing I/O on some file.

BASE + 10
TEMP_FAIL =

Temporary failure, indicating something that is not really an error. For example that a mailer could not create a connection, and the request should be reattempted later.

BASE + 11
PROTOCOL =

The remote system returned something that was ‘not possible’ during a protocol exchange.

BASE + 12
NO_PERM =

You did not have sufficient permission to perform the operation. This is not intended for file system problems, which should use NO_INPUT or CANT_CREATE, but rather for higher level permissions.

BASE + 13
CONFIG_ERROR =

Something was found in an unconfigured or misconfigured state.

BASE + 14
CANNOT_EXECUTE =

Command invoked cannot execute. This may be due to permission issues.

126
COMMAND_NOT_FOUND =

“command not found”, possible typos in shell command or unrecognized characters

127
SIGNAL_BASE =

The start base code for the system interrupt signals.

128
INVALID_ARGUMENT =

Exit takes only integer args in the range 0 - 255, e.g. exit 3.14159 is invalid.

SIGNAL_BASE
HANGUP =

This indicates that program received SIGHUP signal. It means that the controlling pseudo or virtual terminal has been closed.

SIGNAL_BASE + 1
INTERRUPT =

This indicates that program received SIGINT signal. An interrupt signal that by default this causes the process to terminate.

SIGNAL_BASE + 2
QUIT =

This indicates that program received SIGQUIT signal.

SIGNAL_BASE + 3
ILLEGAL_INSTRUCTION =

This indicates that program received SIGQUIT signal.

SIGNAL_BASE + 4
TRACE_TRAP =

This indicates that program received SIGTRAP signal.

SIGNAL_BASE + 5
ABORT =

This indicates that program received SIGABRT signal.

SIGNAL_BASE + 6
KILL =

This indicates that program received SIGKILL signal.

SIGNAL_BASE + 9
BUS_ERROR =

This indicates that program received SIGBUS signal. Access to an undefined portion of a memory object

SIGNAL_BASE + 10
MEMORY_ERROR =

This indicates that program received SIGSEGV signal.

SIGNAL_BASE + 11
PIPE =

This indicates that program received SIGPIPE signal.

SIGNAL_BASE + 13
ALARM =

This indicates that program received SIGALARM signal.

SIGNAL_BASE + 14
USER1 =

This indicates that program received SIGUSR1 signal.

SIGNAL_BASE + 30
USER2 =

This indicates that program received SIGUSR2 signal.

SIGNAL_BASE + 31