I am in the process of porting a CLI library from Ruby over to Node.js. In my code I execute several third party binaries when necessary. I am not sure how best to accomplis
If you want something that closely resembles the top answer but is also synchronous then this will work.
var execSync = require('child_process').execSync; var cmd = "echo 'hello world'"; var options = { encoding: 'utf8' }; console.log(execSync(cmd, options));