feat: idle machine polling

This commit is contained in:
Sérgio Salgado 2021-01-12 18:17:32 +00:00 committed by Josh Harvey
parent ea36d66167
commit 20727a60cd
7 changed files with 198 additions and 0 deletions

View file

@ -0,0 +1,22 @@
const exec = require('child_process')
/**
* Execute simple shell command (async wrapper).
* @param {String} cmd
* @return {Object} { stdout: String, stderr: String }
*/
async function execCommand (cmd) {
return new Promise(function (resolve, reject) {
exec.exec(cmd, (err, stdout, stderr) => {
if (err) {
reject(err)
} else {
console.log(stdout)
console.error(stderr)
// resolve({ stdout, stderr })
}
})
})
}
module.exports = { execCommand }