Skip to content

Instantly share code, notes, and snippets.

@bennycode
Created October 11, 2018 12:46
Show Gist options
  • Save bennycode/4b3bf5de6827c83726cdf70b3d563768 to your computer and use it in GitHub Desktop.
Save bennycode/4b3bf5de6827c83726cdf70b3d563768 to your computer and use it in GitHub Desktop.
Node.js spawn example
const {spawn} = require('child_process');
const child = spawn('node', ['--version'], {
shell: true,
stdio: 'inherit',
});
child.on('exit', () => {
console.log('Command finished.');
process.exit(0);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment