Skip to content

Instantly share code, notes, and snippets.

@rafaelrozon
Created December 11, 2020 15:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rafaelrozon/e7d793c686f78b5c4788132ddf6ca7f4 to your computer and use it in GitHub Desktop.
Save rafaelrozon/e7d793c686f78b5c4788132ddf6ca7f4 to your computer and use it in GitHub Desktop.
Utility function from rzn-scripts
const path = require('path');
const cp = require('child_process');
function runScript(scriptFile) {
cp.execFile(path.resolve(__dirname, `../scripts/${scriptFile}`), (error, stdout, stderr) => {
if (error) {
console.log('runScript/error: ', error);
}
if (stderr) {
console.log('runScript/stderr: ', stderr);
}
console.log('runScript/stdout: ', stdout);
});
}
module.exports = runScript;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment