command.js 393 B

12345678910111213
  1. const util = require('util');
  2. const exec = util.promisify(require('child_process').exec);
  3. var exports = module.exports = {};
  4. exports.runCommand = async function(command) {
  5. console.log("Running shell command: " + command);
  6. const { stdout, stderr } = await exec(command, { shell: true });
  7. if (stderr != "") {
  8. console.error(`error running ${command}: ${stderr}`);
  9. }
  10. };