Results for: "to_proc"

Returns the (real) user ID of this process.

Process.uid   #=> 501

Sets the (user) user ID for this process. Not available on all platforms.

Returns the (real) group ID for this process.

Process.gid   #=> 500

Sets the group ID for this process.

Returns the effective user ID for this process.

Process.euid   #=> 501

Sets the effective user ID for this process. Not available on all platforms.

Returns the effective group ID for this process. Not available on all platforms.

Process.egid   #=> 500

Sets the effective group ID for this process. Not available on all platforms.

Detach the process from controlling terminal and run in the background as system daemon. Unless the argument nochdir is true (i.e. non false), it changes the current working directory to the root (“/”). Unless the argument noclose is true, daemon() will redirect standard input, standard output and standard error to /dev/null. Return zero on success, or raise one of Errno::*.

Returns a Tms structure (see Process::Tms) that contains user and system CPU times for this process, and also for children processes.

t = Process.times
[ t.utime, t.stime, t.cutime, t.cstime ]   #=> [0.0, 0.02, 0.00, 0.00]

Returns the name of the script being executed. The value is not affected by assigning a new value to $0.

This method first appeared in Ruby 2.1 to serve as a global variable free means to get the script name.

Waits for a child process to exit and returns a Process::Status object containing information on that process. Which child it waits on depends on the value of pid:

> 0

Waits for the child whose process ID equals pid.

0

Waits for any child whose process group ID equals that of the calling process.

-1

Waits for any child process (the default if no pid is given).

< -1

Waits for any child whose process group ID equals the absolute value of pid.

The flags argument may be a logical or of the flag values Process::WNOHANG (do not block if no child available) or Process::WUNTRACED (return stopped children that haven’t been reported). Not all flags are available on all platforms, but a flag value of zero will work on all platforms.

Returns nil if there are no child processes. Not available on all platforms.

May invoke the scheduler hook process_wait.

fork { exit 99 }                              #=> 27429
Process::Status.wait                          #=> pid 27429 exit 99
$?                                            #=> nil

pid = fork { sleep 3 }                        #=> 27440
Time.now                                      #=> 2008-03-08 19:56:16 +0900
Process::Status.wait(pid, Process::WNOHANG)   #=> nil
Time.now                                      #=> 2008-03-08 19:56:16 +0900
Process::Status.wait(pid, 0)                  #=> pid 27440 exit 99
Time.now                                      #=> 2008-03-08 19:56:19 +0900

This is an EXPERIMENTAL FEATURE.

Returns true if the integer value of stat equals other.

Logical AND of the bits in stat with num.

fork { exit 0x37 }
Process.wait
sprintf('%04x', $?.to_i)       #=> "3700"
sprintf('%04x', $? & 0x1e00)   #=> "1600"

Shift the bits in stat right num places.

fork { exit 99 }   #=> 26563
Process.wait       #=> 26563
$?.to_i            #=> 25344
$? >> 8            #=> 99

Override the inspection method.

system("false")
p $?.inspect #=> "#<Process::Status: pid 12861 exit 1>"

Returns the process ID that this status object represents.

fork { exit }   #=> 26569
Process.wait    #=> 26569
$?.pid          #=> 26569

Returns true if stat terminated because of an uncaught signal.

Returns the number of the signal that caused stat to terminate (or nil if self was not terminated by an uncaught signal).

Returns true if stat exited normally (for example using an exit() call or finishing the program).

Returns the least significant eight bits of the return code of stat. Only available if exited? is true.

fork { }           #=> 26572
Process.wait       #=> 26572
$?.exited?         #=> true
$?.exitstatus      #=> 0

fork { exit 99 }   #=> 26573
Process.wait       #=> 26573
$?.exited?         #=> true
$?.exitstatus      #=> 99

Returns true if stat is successful, false if not. Returns nil if exited? is not true.

Returns true if stat generated a coredump when it terminated. Not available on all platforms.

Returns the (real) user ID of this process.

Process.uid   #=> 501

Returns the effective user ID for this process.

Process.euid   #=> 501
Search took: 4ms  ·  Total Results: 1700