Skip to content

Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →

class method

Process.daemon

(?untyped nochdir, ?untyped noclose) -> ::Integer
Process.daemon(nochdir = nil, noclose = nil) → 0

Detaches the current process from its controlling terminal and runs it in the background as system daemon; returns zero.

By default:

  • Changes the current working directory to the root directory.

  • Redirects $stdin, $stdout, and $stderr to the null device.

If optional argument nochdir is true, does not change the current working directory.

If optional argument noclose is true, does not redirect $stdin, $stdout, or $stderr.

See also .clock_gettime .detach .clock_getres .egid also in 4.0 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0