Skip to content

Instantly share code, notes, and snippets.

@todoubled
Created November 24, 2012 00:36
Show Gist options
  • Save todoubled/4137833 to your computer and use it in GitHub Desktop.
Save todoubled/4137833 to your computer and use it in GitHub Desktop.
Manage multiple long-running node.js processes.
cp = require 'child_process'
processes = ['make dev-server PORT=8081', 'casperjs test --includes=test/casper-helpers.coffee --cookies-file=/dev/null? test/integration']
processes.forEach (proc) ->
p = cp.spawn 'sh', ['-c', proc]
p.stdout.setEncoding 'utf8'
p.stderr.pipe process.stderr
p.stdout.pipe process.stdout
p.on 'exit', ->
process.kill 'SIGINT'
process.exit 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment