Method: Eye::System.daemonize
- Defined in:
- lib/eye/system.rb
.daemonize(cmd, cfg = {}) ⇒ Object
Daemonize cmd, and detach options:
:pid_file
:working_dir
:environment
:stdin, :stdout, :stderr
63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/eye/system.rb', line 63 def daemonize(cmd, cfg = {}) pid = ::Process.spawn(prepare_env(cfg), *Shellwords.shellwords(cmd), (cfg)) { pid: pid, exitstatus: 0 } rescue Errno::ENOENT, Errno::EACCES => ex { error: ex } ensure Process.detach(pid) if pid end |