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.
The Process::UID
module contains a collection of module functions which can be used to portably get, set, and switch the current process’s real, effective, and saved user IDs.
The Process::GID
module contains a collection of module functions which can be used to portably get, set, and switch the current process’s real, effective, and saved group IDs.
The Process::Sys
module contains UID
and GID
functions which provide direct bindings to the system calls of the same names instead of the more-portable versions of the same functionality found in the Process
, Process::UID
, and Process::GID
modules.
Attempts to activate the current {#possibility} (given that it has already been activated) @return [void]
Attempts to activate the current {#possibility} (given that it hasn’t already been activated) @return [void]
returns the socket type as an integer.
Addrinfo.tcp("localhost", 80).protocol == Socket::IPPROTO_TCP #=> true
Add a new protocol to the DRbProtocol
module.
Add a new protocol to the DRbProtocol
module.
Processes the topmost available {RequirementState} on the stack @return [void]
Convert self
to locale encoding
Returns true
if the underlying file descriptor of ios will be closed automatically at its finalization, otherwise false
.
Sets auto-close flag.
f = open("/dev/null") IO.for_fd(f.fileno) # ... f.gets # may cause IOError f = open("/dev/null") IO.for_fd(f.fileno).autoclose = true # ... f.gets # won't cause IOError
Convert self
to locale encoding
Convert self
to locale encoding