Skip to content

Instantly share code, notes, and snippets.

@joshmanders
Last active July 29, 2016 13:35
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 joshmanders/a1f4d126af602daa8ea401bc453d740a to your computer and use it in GitHub Desktop.
Save joshmanders/a1f4d126af602daa8ea401bc453d740a to your computer and use it in GitHub Desktop.
const { spawn } = require('child_process')
const grunt = spawn('grunt', {
env: Object.assign({}, process.env, { PATH: `./node_modules/.bin:${process.env.PATH}` }),
stdio: 'inherit'
})
grunt.on('close', (code) => {
console.log(`Grunt closed with error code ${code}`)
process.exit(code)
})
grunt.on('error', (error) => {
console.log(`Grunt error: ${error}`)
process.exit(1)
})
process.on('exit', () => {
grunt.kill()
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment