Sha256: be009d3f1d57f746926889b0a432ce68c3e9eec255fb8473bdb20ccb1a28fffd

Contents?: true

Size: 515 Bytes

Versions: 14

Compression:

Stored size: 515 Bytes

Contents

module Process
  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"
      STDIN.reopen null
      STDOUT.reopen null
      STDERR.reopen null
    end

    0
  end unless respond_to?(:daemon)
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
puma-2.1.0-java lib/puma/daemon_ext.rb
puma-2.1.0 lib/puma/daemon_ext.rb
puma-2.0.1-java lib/puma/daemon_ext.rb
puma-2.0.1 lib/puma/daemon_ext.rb
puma-2.0.0-java lib/puma/daemon_ext.rb
puma-2.0.0 lib/puma/daemon_ext.rb
puma-2.0.0.b7-java lib/puma/daemon_ext.rb
puma-2.0.0.b7 lib/puma/daemon_ext.rb
puma-2.0.0.b6 lib/puma/daemon_ext.rb
puma-2.0.0.b5 lib/puma/daemon_ext.rb
puma-2.0.0.b4-java lib/puma/daemon_ext.rb
puma-2.0.0.b4 lib/puma/daemon_ext.rb
puma-2.0.0.b3-java lib/puma/daemon_ext.rb
puma-2.0.0.b3 lib/puma/daemon_ext.rb