Sha256: 963c8af6ac855884d8f4d24b54c108a4b8ceeb4be40c5c830a5ed75665ffa442

Contents?: true

Size: 725 Bytes

Versions: 22

Compression:

Stored size: 725 Bytes

Contents

# frozen_string_literal: true

module Process

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

  if respond_to? :daemon
    class << self
      remove_method :daemon
    end
  end

  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

22 entries across 22 versions & 3 rubygems

Version Path
piesync-puma-3.12.6.1 lib/puma/daemon_ext.rb
piesync-puma-3.12.6 lib/puma/daemon_ext.rb
puma-3.12.6-java lib/puma/daemon_ext.rb
puma-3.12.6 lib/puma/daemon_ext.rb
puma-3.12.5-java lib/puma/daemon_ext.rb
puma-3.12.5 lib/puma/daemon_ext.rb
puma-3.12.4-java lib/puma/daemon_ext.rb
puma-3.12.4 lib/puma/daemon_ext.rb
puma-3.12.2-java lib/puma/daemon_ext.rb
puma-3.12.2 lib/puma/daemon_ext.rb
chatops-rpc-0.0.2 fixtures/chatops-controller-example/vendor/bundle/ruby/2.5.0/gems/puma-3.12.1/lib/puma/daemon_ext.rb
chatops-rpc-0.0.1 fixtures/chatops-controller-example/vendor/bundle/ruby/2.5.0/gems/puma-3.12.1/lib/puma/daemon_ext.rb
puma-4.1.1-java lib/puma/daemon_ext.rb
puma-4.1.1 lib/puma/daemon_ext.rb
puma-4.1.0-java lib/puma/daemon_ext.rb
puma-4.1.0 lib/puma/daemon_ext.rb
puma-4.0.1-java lib/puma/daemon_ext.rb
puma-4.0.1 lib/puma/daemon_ext.rb
puma-4.0.0-java lib/puma/daemon_ext.rb
puma-4.0.0 lib/puma/daemon_ext.rb