DemuMesDataV/publish/plugin/exec.js

19 lines
337 B
JavaScript
Raw Normal View History

2019-07-03 22:00:43 +08:00
const { exec } = require('child_process')
function doExec (execString, maxBuffer = 1024 ** 5) {
return new Promise(resolve => {
exec(execString, {
maxBuffer
}, err => {
if (err) {
console.error(err)
resolve(false)
} else {
resolve(true)
}
})
})
}
module.exports = doExec