Type:
Class

Process::Status encapsulates the information on the status of a running or terminated system process. The built-in variable $? is either nil or a Process::Status object.

fork { exit 99 }   #=> 26557
Process.wait       #=> 26557
$?.class           #=> Process::Status
$?.to_i            #=> 25344
$? >> 8            #=> 99
$?.stopped?        #=> false
$?.exited?         #=> true
$?.exitstatus      #=> 99

Posix systems record information on processes using a 16-bit integer. The lower bits record the process status (stopped, exited, signaled) and the upper bits possibly contain additional information (for example the program's return code in the case of exited processes). Pre Ruby 1.8, these bits were exposed directly to the Ruby program. Ruby now encapsulates these in a Process::Status object. To maximize compatibility, however, these objects retain a bit-oriented interface. In the descriptions that follow, when we talk about the integer value of stat, we're referring to this 16 bit value.

signaled?

stat.signaled? â true or false Instance Public methods Returns true

2015-04-28 17:49:43
&

stat & num â fixnum Instance Public methods Logical AND of the bits in

2015-04-28 17:22:43
exitstatus

stat.exitstatus â fixnum or nil Instance Public methods Returns the least

2015-04-28 17:41:03
pid

stat.pid â fixnum Instance Public methods Returns the process ID that this

2015-04-28 17:43:27
stopped?

stat.stopped? â true or false Instance Public methods Returns true

2015-04-28 17:55:51