徐总多门店
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

31 lines
692 B

'use strict';
const execa = require('execa');
const executable = require('executable');
module.exports = (bin, args) => {
if (!Array.isArray(args)) {
args = ['--help'];
}
return executable(bin)
.then(works => {
if (!works) {
throw new Error(`Couldn't execute the \`${bin}\` binary. Make sure it has the right permissions.`);
}
return execa(bin, args);
})
.then(res => res.code === 0);
};
module.exports.sync = (bin, args) => {
if (!Array.isArray(args)) {
args = ['--help'];
}
if (!executable.sync(bin)) {
throw new Error(`Couldn't execute the \`${bin}\` binary. Make sure it has the right permissions.`);
}
return execa.sync(bin, args).status === 0;
};