All files / server/tests command.js

100% Statements 10/10
100% Branches 0/0
100% Functions 4/4
100% Lines 7/7
1 2 3 4 5 6 7 8 9 10  1x 1x 1x 1x 1x 1x 1x    
// Execute a command on the Terminal with a promise
module.exports = (cmd, args) => new Promise((resolve, reject) => {
  var spawn = require('child_process').spawn;
  var child = spawn(cmd, args);
  var resp = "";
  child.stdout.on('data', buffer => resp += buffer.toString());
  child.stdout.on('end', () => resolve(resp));
  child.on('error', reject);
});