Skip to content

Instantly share code, notes, and snippets.

@niradler
Last active November 7, 2018 16:56
Show Gist options
  • Save niradler/276407b28ca34f5eb8e067b4c1dad791 to your computer and use it in GitHub Desktop.
Save niradler/276407b28ca34f5eb8e067b4c1dad791 to your computer and use it in GitHub Desktop.
shell interaction nodejs
const exec = require('child_process').exec;
const shell = (cmd) => {
const script = exec(cmd,
(error, stdout, stderr) => {
if (error !== null) {
console.error(error);
}
});
script.stdout.pipe(process.stdout);
}
module.exports = shell;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment