New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

command-exists

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

command-exists - npm Package Compare versions

Comparing version 1.2.3 to 1.2.4

31

lib/command-exists.js

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

var commandExistsUnix = function(commandName, callback) {
var commandExistsUnix = function(commandName, cleanedCommandName, callback) {

@@ -50,5 +50,5 @@ fileNotExists(commandName, function(isFile){

if(!isFile){
var child = exec('command -v ' + commandName +
var child = exec('command -v ' + cleanedCommandName +
' 2>/dev/null' +
' && { echo >&1 \'' + commandName + ' found\'; exit 0; }',
' && { echo >&1 ' + cleanedCommandName + '; exit 0; }',
function (error, stdout, stderr) {

@@ -65,4 +65,4 @@ callback(null, !!stdout);

var commandExistsWindows = function(commandName, callback) {
var child = exec('where ' + commandName,
var commandExistsWindows = function(commandName, cleanedCommandName, callback) {
var child = exec('where ' + cleanedCommandName,
function (error) {

@@ -78,8 +78,8 @@ if (error !== null){

var commandExistsUnixSync = function(commandName) {
var commandExistsUnixSync = function(commandName, cleanedCommandName) {
if(fileNotExistsSync(commandName)){
try {
var stdout = execSync('command -v ' + commandName +
var stdout = execSync('command -v ' + cleanedCommandName +
' 2>/dev/null' +
' && { echo >&1 \'' + commandName + ' found\'; exit 0; }'
' && { echo >&1 ' + cleanedCommandName + '; exit 0; }'
);

@@ -93,8 +93,7 @@ return !!stdout;

return localExecutableSync(commandName);
}
var commandExistsWindowsSync = function(commandName, callback) {
var commandExistsWindowsSync = function(commandName, cleanedCommandName, callback) {
try {
var stdout = execSync('where ' + commandName);
var stdout = execSync('where ' + cleanedCommandName);
return !!stdout;

@@ -114,3 +113,3 @@ } catch (error) {

return new Promise(function(resolve, reject){
commandExists(cleanedCommandName, function(error, output){
commandExists(commandName, function(error, output) {
if (output) {

@@ -125,5 +124,5 @@ resolve(commandName);

if (isUsingWindows) {
commandExistsWindows(cleanedCommandName, callback);
commandExistsWindows(commandName, cleanedCommandName, callback);
} else {
commandExistsUnix(cleanedCommandName, callback);
commandExistsUnix(commandName, cleanedCommandName, callback);
}

@@ -135,6 +134,6 @@ };

if (isUsingWindows) {
return commandExistsWindowsSync(cleanedCommandName);
return commandExistsWindowsSync(commandName, cleanedCommandName);
} else {
return commandExistsUnixSync(cleanedCommandName);
return commandExistsUnixSync(commandName, cleanedCommandName);
}
};
{
"name": "command-exists",
"version": "1.2.3",
"version": "1.2.4",
"description": "check whether a command line command exists in the current environment",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc