Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
generic way to spawn
// 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
You can’t perform that action at this time.