Sha256: ff216e7fcf68647294baa16720c942c407dabcd5d566c574ebbd799038f7263d

Contents?: true

Size: 608 Bytes

Versions: 133

Compression:

Stored size: 608 Bytes

Contents

module Process

  # This overrides the default version because it is broken if it
  # exists.

  def self.daemon(nochdir=false, noclose=false)
    exit if fork                     # Parent exits, child continues.

    Process.setsid                   # Become session leader.

    exit if fork                     # Zap session leader. See [1].

    Dir.chdir "/" unless nochdir     # Release old working directory.

    if !noclose
      STDIN.reopen File.open("/dev/null", "r")

      null_out = File.open "/dev/null", "w"
      STDOUT.reopen null_out
      STDERR.reopen null_out
    end

    0
  end
end

Version data entries

133 entries across 130 versions & 18 rubygems

Version Path
puma-2.12.2-java lib/puma/daemon_ext.rb
puma-2.12.2 lib/puma/daemon_ext.rb
puma-2.12.1-java lib/puma/daemon_ext.rb
puma-2.12.1 lib/puma/daemon_ext.rb
puma-2.12.0-java lib/puma/daemon_ext.rb
puma-2.12.0 lib/puma/daemon_ext.rb
puma-2.11.3-java lib/puma/daemon_ext.rb
puma-2.11.3 lib/puma/daemon_ext.rb
puma-2.11.2-java lib/puma/daemon_ext.rb
puma-2.11.2 lib/puma/daemon_ext.rb
puma-2.11.1-java lib/puma/daemon_ext.rb
puma-2.11.1 lib/puma/daemon_ext.rb
puma-2.11.0-java lib/puma/daemon_ext.rb
puma-2.11.0 lib/puma/daemon_ext.rb
puma-2.10.2-java lib/puma/daemon_ext.rb
puma-2.10.2 lib/puma/daemon_ext.rb
puma-2.10.1-java lib/puma/daemon_ext.rb
puma-2.10.1 lib/puma/daemon_ext.rb
puma-2.10.0-java lib/puma/daemon_ext.rb
puma-2.10.0 lib/puma/daemon_ext.rb