Sha256: 3b72c50c22559aacc0bdf6674ed6a60e77ce0b4d2296d01875f87ec29b7d4223

Contents?: true

Size: 439 Bytes

Versions: 5

Compression:

Stored size: 439 Bytes

Contents

module Process
  class << self
    unless method_defined?(:daemon)
      def daemon(nochdir = nil, noclose = nil)
        exit!(0) if Process.fork
        Process.setsid
        exit!(0) if Process.fork
        Dir.chdir("/") unless nochdir
        unless noclose
          STDIN.reopen("/dev/null", "r")
          STDOUT.reopen("/dev/null", "w")
          STDERR.reopen("/dev/null", "w")
        end
        0
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
pmux-0.1.3 lib/pmux/util_daemon.rb
pmux-0.1.2 lib/pmux/util_daemon.rb
pmux-0.1.1 lib/pmux/util_daemon.rb
pmux-0.1.0 lib/pmux/util_daemon.rb
gflocator-0.0.1 lib/gflocator/util_daemon.rb