Skip to content

Instantly share code, notes, and snippets.

@geta6
Last active December 23, 2015 23:29
Show Gist options
  • Save geta6/6710313 to your computer and use it in GitHub Desktop.
Save geta6/6710313 to your computer and use it in GitHub Desktop.
{spawn} = require 'child_process'
unless process.env.__daemon
args = [].concat process.argv
args.shift()
args.shift()
process.env.__daemon = yes
child = spawn process.mainModule.filename, args,
stdio: 'ignore'
env: process.env
cwd: process.cwd()
detached: yes
child.unref()
process.exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment