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