Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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