Created
December 11, 2020 15:53
-
-
Save rafaelrozon/e7d793c686f78b5c4788132ddf6ca7f4 to your computer and use it in GitHub Desktop.
Utility function from rzn-scripts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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