schnee effeckt und fehler Korektur
This commit is contained in:
48
node_modules/bin-check/index.js
generated
vendored
48
node_modules/bin-check/index.js
generated
vendored
@@ -1,29 +1,31 @@
|
||||
'use strict';
|
||||
var spawn = require('child_process').spawn;
|
||||
var executable = require('executable');
|
||||
const execa = require('execa');
|
||||
const executable = require('executable');
|
||||
|
||||
module.exports = function (bin, cmd, cb) {
|
||||
if (typeof cmd === 'function') {
|
||||
cb = cmd;
|
||||
cmd = ['--help'];
|
||||
module.exports = (bin, args) => {
|
||||
if (!Array.isArray(args)) {
|
||||
args = ['--help'];
|
||||
}
|
||||
|
||||
executable(bin, function (err, works) {
|
||||
if (err) {
|
||||
cb(err);
|
||||
return;
|
||||
}
|
||||
return executable(bin)
|
||||
.then(works => {
|
||||
if (!works) {
|
||||
throw new Error(`Couldn't execute the \`${bin}\` binary. Make sure it has the right permissions.`);
|
||||
}
|
||||
|
||||
if (!works) {
|
||||
cb(new Error('Couldn\'t execute the `' + bin + '` binary. Make sure it has the right permissions.'));
|
||||
return;
|
||||
}
|
||||
|
||||
var cp = spawn(bin, cmd);
|
||||
|
||||
cp.on('error', cb);
|
||||
cp.on('exit', function (code) {
|
||||
cb(null, code === 0);
|
||||
});
|
||||
});
|
||||
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;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user