Fork
Constants
VERSION = "0.1.0"
Instance methods
fork
Forks a new child process.
- In the child process,
0will be returned. - In the parent process, the child process'es PID will be returned.
if (pid = Fork.fork) == 0
# in the child process
else
# in the parent process
end
fork
Forks a new child process.
- In the child process, the given block will be called.
- In the parent process, the process will wait for the child process to exit and return the child process'es exit status.
status = Fork.fork do
# in the child process
end
puts "Child process exited with #{status.exit_status}"
wait
Waits for any child to exit and retuns the exit status.
Raises an Error exception if the
wait(2)
syscall returned -1.
waitpid(pid : PidT, options = WaitPidFlags::NONE) : Process::Status
Waits for a specific child process to exit and rturns the exit status.
Raises an Error exception if the
waitpid(2)
syscall returned -1.