Sha256: 6ad401bee374eeabd6957b170604d564bd5ec5c3109607a748e5d41ab3f51c5a

Contents?: true

Size: 573 Bytes

Versions: 2

Compression:

Stored size: 573 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
      null = File.open "/dev/null", "w+"
      STDIN.reopen null
      STDOUT.reopen null
      STDERR.reopen null
    end

    0
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
puma-2.7.0-java lib/puma/daemon_ext.rb
puma-2.7.0 lib/puma/daemon_ext.rb