Skip to content

Instantly share code, notes, and snippets.

@rjcorwin
Created October 3, 2018 21:41
Show Gist options
  • Save rjcorwin/b56ff2fbb6428e2af352ef67e339c085 to your computer and use it in GitHub Desktop.
Save rjcorwin/b56ff2fbb6428e2af352ef67e339c085 to your computer and use it in GitHub Desktop.
const util = require('util');
const exec = util.promisify(require('child_process').exec)
const go = async () => {
try {
const output1 = await exec('echo 1')
console.log(output1.stdout)
const output2 = await exec('echo 2')
console.log(output2.stdout)
const output3 = await exec('echo 3')
console.log(output3.stdout)
} catch (error) {
console.log('An exec process exited with a status code other than 0')
console.log(error)
}
}
go()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment