Last active
January 29, 2018 08:26
generic way to spawn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// the old way | |
const cp = require('child_process'); | |
const k = cp.spawn('npm', ['install','lodash']); | |
k.stdout.on('data', yourHandlerHere); | |
// the more generic way | |
const cp = require('child_process'); | |
const k = cp.spawn('bash'); | |
k.stdout.on('data', yourHandlerHere); | |
k.stdin.write('npm install lodash'); | |
k.stdin.end('\n'); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment