Process::ExitReason
Inherits Enum / Comparable / Value / Object
The reason why a process terminated.
This enum provides a platform-independent way to query any exceptions that
occurred upon a process's termination, via Process::Status#exit_reason.
Constants
The process exited normally.
- On Unix-like systems, this implies
Process::Status#normal_exit?is true. - On Windows, only exit statuses less than
0x40000000are assumed to be reserved for normal exits.
The process terminated due to an abort request.
- On Unix-like systems, this corresponds to
Signal::ABRT,Signal::KILL, andSignal::QUIT. - On Windows, this corresponds to the
NTSTATUSvalueSTATUS_FATAL_APP_EXIT.
The process exited due to an interrupt request.
- On Unix-like systems, this corresponds to
Signal::INT. - On Windows, this corresponds to the Ctrl + C and Ctrl + Break signals for console applications.
The process reached a debugger breakpoint, but no debugger was attached.
- On Unix-like systems, this corresponds to
Signal::TRAP. - On Windows, this corresponds to the
NTSTATUSvalueSTATUS_BREAKPOINT.
The process tried to access a memory address where a read or write was not allowed.
- On Unix-like systems, this corresponds to
Signal::SEGV. - On Windows, this corresponds to the
NTSTATUSvaluesSTATUS_ACCESS_VIOLATIONandSTATUS_STACK_OVERFLOW.
The process tried to access an invalid memory address.
- On Unix-like systems, this corresponds to
Signal::BUS. - On Windows, this corresponds to the
NTSTATUSvalueSTATUS_DATATYPE_MISALIGNMENT.
The process tried to execute an invalid instruction.
- On Unix-like systems, this corresponds to
Signal::ILL. - On Windows, this corresponds to the
NTSTATUSvaluesSTATUS_ILLEGAL_INSTRUCTIONandSTATUS_PRIVILEGED_INSTRUCTION.
A hardware floating-point exception occurred.
- On Unix-like systems, this corresponds to
Signal::FPE. - On Windows, this corresponds to the
NTSTATUSvaluesSTATUS_FLOAT_DIVIDE_BY_ZERO,STATUS_FLOAT_INEXACT_RESULT,STATUS_FLOAT_INVALID_OPERATION,STATUS_FLOAT_OVERFLOW, andSTATUS_FLOAT_UNDERFLOW.
The process exited due to a POSIX signal.
Only applies to signals without a more specific exit reason. Unused on Windows.
The process exited in a way that cannot be represented by any other
ExitReasons.
A Process::Status that maps to Unknown may map to a different value if
new enum members are added to ExitReason.
The process exited due to the user closing the terminal window or ending an ssh session.
- On Unix-like systems, this corresponds to
Signal::HUP. - On Windows, this corresponds to the
CTRL_CLOSE_EVENTmessage.
The process exited due to the user logging off or shutting down the OS.
- On Unix-like systems, this corresponds to
Signal::TERM. - On Windows, this corresponds to the
CTRL_LOGOFF_EVENTandCTRL_SHUTDOWN_EVENTmessages.
Instance methods
Returns true if the process exited abnormally.
This includes all values except Normal.
Returns a textual description of this exit reason.
Process::ExitReason::Normal.description # => "Process exited normally"
Process::ExitReason::Aborted.description # => "Process terminated abnormally"
Status#description provides more detail for a specific process status.