Socket
Socket
Sign inDemoInstall

bin-check

Package Overview
Dependencies
1
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.5 to 0.2.0

36

index.js

@@ -9,3 +9,3 @@ 'use strict';

*
* @param {String} name
* @param {String} bin
* @param {String|Array} cmd

@@ -16,5 +16,3 @@ * @param {Function} cb

module.exports = function (name, cmd, cb) {
var bin;
module.exports = function (bin, cmd, cb) {
if (typeof cmd === 'function') {

@@ -25,8 +23,3 @@ cb = cmd;

cmd = cmd || ['--help'];
cmd = Array.isArray(cmd) ? cmd : [cmd];
executable(name, function (err, works) {
var msg;
executable(bin, function (err, w) {
if (err) {

@@ -36,17 +29,10 @@ return cb(err);

if (works) {
bin = spawn(name, cmd);
bin.on('error', function (err) {
return cb(err);
});
bin.stdout.setEncoding('utf8');
bin.stdout.on('data', function (data) {
msg += data;
});
bin.on('exit', function (code) {
return cb(null, code === 0 ? true : false, msg);
});
if (w) {
spawn(bin, cmd)
.on('error', function (err) {
return cb(err);
})
.on('exit', function (code) {
return cb(null, code === 0 ? true : false);
});
} else {

@@ -53,0 +39,0 @@ return cb(null, false);

{
"name": "bin-check",
"version": "0.1.5",
"version": "0.2.0",
"description": "Check if a binary is working",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -16,9 +16,6 @@ # bin-check [![Build Status](https://travis-ci.org/kevva/bin-check.svg?branch=master)](https://travis-ci.org/kevva/bin-check)

binCheck('/bin/sh', ['--version'], function (err, works, msg) {
binCheck('/bin/sh', ['--version'], function (err, works) {
if (err) {
throw err;
}
console.log(msg);
// => GNU bash, version 3.2.51(1)-release-(x86_64-apple-darwin13)

@@ -32,3 +29,3 @@ console.log(works);

### binCheck(name, cmd, cb)
### binCheck(bin, cmd, cb)

@@ -35,0 +32,0 @@ Check if a binary is working by checking its exit code. Use `cmd` to test against

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc