Skip to content

Instantly share code, notes, and snippets.

@wkentdag
Created October 2, 2016 00:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wkentdag/f7f2daff08030db23bbde3febebb93eb to your computer and use it in GitHub Desktop.
Save wkentdag/f7f2daff08030db23bbde3febebb93eb to your computer and use it in GitHub Desktop.
good way to call child processes inside a node script

elegantly call child processes within node

const node = require('when/node')
const {exec} = require('child_process')
const tplTestPath = path.join(__dirname, 'example')

function npmInstall (dir) {
  return node.call(exec, 'npm install', { cwd: dir })
}

npmInstall.bind(null, tplTestPath)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment