HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //home/arjun/projects/buyercall_forms/buyercall/node_modules/bin-check/index.js
'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;
};