How to use the executable.sync function in executable

To help you get started, we’ve selected a few executable examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github webtorrent / webtorrent-cli / bin / cmd.js View on Github external
function checkPermission (filename) {
  try {
    if (!executable.sync(filename)) {
      return errorAndExit(`Script "${filename}" is not executable`)
    }
  } catch (err) {
    return errorAndExit(`Script "${filename}" does not exist`)
  }
}
github Jalle19 / node-ffmpeg-mpegts-proxy / node-ffmpeg-mpegts-proxy.js View on Github external
var runPrePostScript = function(scriptPath, params) {
	try {
		if (executable.sync(scriptPath)) {
			child_process.spawnSync(scriptPath, params);
		} else {
			winston.error("The specified script is not executable");
		}
	}
	catch (e) {
		winston.error("The specified script doesn't exist");
	}
};
github kevva / bin-check / index.js View on Github external
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;
};

executable

Check if a file is executable

MIT
Latest version published 6 years ago

Package Health Score

65 / 100
Full package analysis