enum

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

Normal = 0

The process exited normally.

  • On Unix-like systems, this implies Process::Status#normal_exit? is true.
  • On Windows, only exit statuses less than 0x40000000 are assumed to be reserved for normal exits.
Aborted = 1

The process terminated due to an abort request.

  • On Unix-like systems, this corresponds to Signal::ABRT, Signal::KILL, and Signal::QUIT.
  • On Windows, this corresponds to the NTSTATUS value STATUS_FATAL_APP_EXIT.
Interrupted = 2

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.
Breakpoint = 3

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 NTSTATUS value STATUS_BREAKPOINT.
AccessViolation = 4

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 NTSTATUS values STATUS_ACCESS_VIOLATION and STATUS_STACK_OVERFLOW.
BadMemoryAccess = 5

The process tried to access an invalid memory address.

  • On Unix-like systems, this corresponds to Signal::BUS.
  • On Windows, this corresponds to the NTSTATUS value STATUS_DATATYPE_MISALIGNMENT.
BadInstruction = 6

The process tried to execute an invalid instruction.

  • On Unix-like systems, this corresponds to Signal::ILL.
  • On Windows, this corresponds to the NTSTATUS values STATUS_ILLEGAL_INSTRUCTION and STATUS_PRIVILEGED_INSTRUCTION.
FloatException = 7

A hardware floating-point exception occurred.

  • On Unix-like systems, this corresponds to Signal::FPE.
  • On Windows, this corresponds to the NTSTATUS values STATUS_FLOAT_DIVIDE_BY_ZERO, STATUS_FLOAT_INEXACT_RESULT, STATUS_FLOAT_INVALID_OPERATION, STATUS_FLOAT_OVERFLOW, and STATUS_FLOAT_UNDERFLOW.
Signal = 8

The process exited due to a POSIX signal.

Only applies to signals without a more specific exit reason. Unused on Windows.

Unknown = 9

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.

TerminalDisconnected = 10

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_EVENT message.
SessionEnded = 11

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_EVENT and CTRL_SHUTDOWN_EVENT messages.

Instance methods

abnormal?

Returns true if the process exited abnormally.

This includes all values except Normal.

Source
aborted?

Returns true if this enum value equals Aborted

Source
access_violation?

Returns true if this enum value equals AccessViolation

Source
bad_instruction?

Returns true if this enum value equals BadInstruction

Source
bad_memory_access?

Returns true if this enum value equals BadMemoryAccess

Source
breakpoint?

Returns true if this enum value equals Breakpoint

Source
description

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.

Source
float_exception?

Returns true if this enum value equals FloatException

Source
interrupted?

Returns true if this enum value equals Interrupted

Source
normal?

Returns true if this enum value equals Normal

Source
session_ended?

Returns true if this enum value equals SessionEnded

Source
signal?

Returns true if this enum value equals Signal

Source
terminal_disconnected?

Returns true if this enum value equals TerminalDisconnected

Source
unknown?

Returns true if this enum value equals Unknown

Source