(command, callback)
| 2 | const { exec } = require('child_process'); |
| 3 | |
| 4 | const execute = (command, callback) => { |
| 5 | const child = exec(command); |
| 6 | child.stderr.on('data', data => { process.stdout.write(data); }); |
| 7 | child.stdout.on('data', data => { process.stdout.write(data); }); |
| 8 | if (callback) { |
| 9 | child.once('exit', () => { callback(); }); |
| 10 | } |
| 11 | }; |
| 12 | |
| 13 | exports.execute = execute; |