Sha256: ca159fee59b69740aa1eac2ad2bf1c35b34e6ca00425516694a25e323bc2f4e9

Contents?: true

Size: 521 Bytes

Versions: 26

Compression:

Stored size: 521 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", "w+"
      STDIN.reopen null
      STDOUT.reopen null
      STDERR.reopen null
    end

    0
  end unless respond_to?(:daemon)
end

Version data entries

26 entries across 26 versions & 2 rubygems

Version Path
mango-0.7.1 vendor/bundler/ruby/2.0.0/gems/puma-2.6.0/lib/puma/daemon_ext.rb
mango-0.7.0 vendor/bundler/ruby/2.0.0/gems/puma-2.6.0/lib/puma/daemon_ext.rb
puma-2.6.0-java lib/puma/daemon_ext.rb
puma-2.6.0 lib/puma/daemon_ext.rb
puma-2.5.1-java lib/puma/daemon_ext.rb
puma-2.5.1 lib/puma/daemon_ext.rb
puma-2.5.0-java lib/puma/daemon_ext.rb
puma-2.5.0 lib/puma/daemon_ext.rb
puma-2.4.1-java lib/puma/daemon_ext.rb
puma-2.4.1 lib/puma/daemon_ext.rb
puma-2.4.0-java lib/puma/daemon_ext.rb
puma-2.4.0 lib/puma/daemon_ext.rb
puma-2.3.2-java lib/puma/daemon_ext.rb
puma-2.3.2 lib/puma/daemon_ext.rb
puma-2.3.1-java lib/puma/daemon_ext.rb
puma-2.3.1 lib/puma/daemon_ext.rb
puma-2.3.0-java lib/puma/daemon_ext.rb
puma-2.3.0 lib/puma/daemon_ext.rb
puma-2.2.2-java lib/puma/daemon_ext.rb
puma-2.2.2 lib/puma/daemon_ext.rb