Ruby Process Functions
EditRocket provides the following information on Process functions in the Ruby source code builder.
abort - Terminate execution immediately, effectively by calling Kernel.exit(1). If msg is given, it is written to STDERR prior to terminating.
detach(pid) - Some operating systems retain the status of terminated child processes until the parent collects that status (normally using some variant of wait(). If the parent never collects this status, the child stays around as a zombie process. Process::detach prevents this by setting up a separate Ruby thread whose sole job is to reap the status of the process pid when it terminates. Use detach only when you do not intent to explicitly wait for the child to terminate. detach only checks the status periodically (currently once each second).
egid= - Sets the effective group ID for this process. Not available on all platforms.
egid - Returns the effective group ID for this process. Not available on all platforms.
euid= - Sets the effective user ID for this process. Not available on all platforms.
euid - Returns the effective user ID for this process.
exit!(fixnum=-1) - Exits the process immediately. No exit handlers are run. fixnum is returned to the underlying system as the exit status.
exit exit(integer=0) - Initiates the termination of the Ruby script by raising the SystemExit exception. This exception may be caught. The optional parameter is used to return a status code to the invoking environment.
fork - Creates a subprocess. If a block is specified, that block is run in the subprocess, and the subprocess terminates with a status of zero. Otherwise, the fork call returns twice, once in the parent, returning the process ID of the child, and once in the child, returning nil. The child process can exit using Kernel.exit! to avoid running any at_exit functions. The parent process should use Process.wait to collect the termination statuses of its children or use Process.detach to register disinterest in their status; otherwise, the operating system may accumulate zombie processes.
getpgid(pid) - Returns the process group ID for the given process id. Not available on all platforms.
getpriority(kind, integer) - "Gets the scheduling priority for specified process, process group, or user. kind indicates the kind of entity to find: one of Process::PRIO_PGRP, Process::PRIO_USER, or Process::PRIO_PROCESS. integer is an id indicating the particular process, process group, or user (an id of 0 means current). Lower priorities are more favorable for scheduling. Not available on all platforms."
getrlimit(resource) - Gets the resource limit of the process. cur_limit means current (soft) limit and max_limit means maximum (hard) limit.
gid= - Sets the group ID for this process.
gid - Returns the (real) group ID for this process.
groups= - Set the supplemental group access list to the given Array of group IDs.
groups - Get an Array of the gids of groups in the supplemental group access list for this process.
initgroups(username, gid) - Initializes the supplemental group access list by reading the system group database and using all groups of which the given user is a member. The group with the specified gid is also added to the list. Returns the resulting Array of the gids of all the groups in the supplementary group access list. Not available on all platforms.
kill(signal, pid, ...) - Sends the given signal to the specified process id(s), or to the current process if pid is zero. signal may be an integer signal number or a POSIX signal name (either with or without a SIG prefix). If signal is negative (or starts with a minus sign), kills process groups instead of processes. Not all signals are available on all platforms.
maxgroups= - Sets the maximum number of gids allowed in the supplemental group access list.
maxgroups - Returns the maximum number of gids allowed in the supplemental group access list.
pid - Returns the process id of this process. Not available on all platforms.
ppid - Returns the process id of the parent of this process. Always returns 0 on NT. Not available on all platforms.
setpgid(pid, integer) - Sets the process group ID of pid (0 indicates this process) to integer. Not available on all platforms.
setpgrp - Equivalent to setpgid(0,0). Not available on all platforms.
setpriority(kind, integer, priority) - See Process#getpriority.
setrlimit(resource, cur_limit, max_limit) - Sets the resource limit of the process. cur_limit means current (soft) limit and max_limit means maximum (hard) limit.
setsid - Establishes this process as a new session and process group leader, with no controlling tty. Returns the session id. Not available on all platforms.
times - Returns a Tms structure (see Struct::Tms on page 388) that contains user and system CPU times for this process.
uid= - Sets the (integer) user ID for this process. Not available on all platforms.
uid - Returns the (real) user ID of this process.
wait() - "Waits for a child process to exit, returns its process id, and sets $? to a Process::Status object containing information on that process. Which child it waits on depends on the value of pid:"
wait2(pid=-1, flags=0) - Waits for a child process to exit (see Process::waitpid for exact semantics) and returns an array containing the process id and the exit status (a Process::Status object) of that child. Raises a SystemError if there are no child processes.
waitall - Waits for all children, returning an array of pid/status pairs (where status is a Process::Status object).
waitpid(pid=-1, flags=0) - "Waits for a child process to exit, returns its process id, and sets $? to a Process::Status object containing information on that process. Which child it waits on depends on the value of pid:"
waitpid2(pid=-1, flags=0) - Waits for a child process to exit (see Process::waitpid for exact semantics) and returns an array containing the process id and the exit status (a Process::Status object) of that child. Raises a SystemError if there are no child processes.