Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cross-spawn

Package Overview
Dependencies
Maintainers
1
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cross-spawn - npm Package Compare versions

Comparing version 3.0.1 to 4.0.0

foo

34

lib/parse.js

@@ -6,2 +6,3 @@ 'use strict';

var resolveCommand = require('./resolveCommand');
var hasBrokenSpawn = require('./hasBrokenSpawn');

@@ -78,2 +79,6 @@ var isWin = process.platform === 'win32';

function requiresShell(command) {
return !/\.(?:com|exe)$/i.test(command);
}
function parse(command, args, options) {

@@ -84,2 +89,3 @@ var shebang;

var original;
var shell;

@@ -101,2 +107,3 @@ // Normalize arguments, similar to nodejs

shebang = file && readShebang(file);
shell = options.shell || hasBrokenSpawn;

@@ -106,17 +113,22 @@ if (shebang) {

command = shebang;
shell = shell || requiresShell(resolveCommand(shebang) || resolveCommand(shebang, true));
} else {
shell = shell || requiresShell(file);
}
// Escape command & arguments
applyQuotes = command !== 'echo'; // Do not quote arguments for the special "echo" command
command = escapeCommand(command);
args = args.map(function (arg) {
return escapeArg(arg, applyQuotes);
});
if (shell) {
// Escape command & arguments
applyQuotes = (command !== 'echo'); // Do not quote arguments for the special "echo" command
command = escapeCommand(command);
args = args.map(function (arg) {
return escapeArg(arg, applyQuotes);
});
// Use cmd.exe
args = ['/s', '/c', '"' + command + (args.length ? ' ' + args.join(' ') : '') + '"'];
command = process.env.comspec || 'cmd.exe';
// Use cmd.exe
args = ['/s', '/c', '"' + command + (args.length ? ' ' + args.join(' ') : '') + '"'];
command = process.env.comspec || 'cmd.exe';
// Tell node's spawn that the arguments are already escaped
options.windowsVerbatimArguments = true;
// Tell node's spawn that the arguments are already escaped
options.windowsVerbatimArguments = true;
}
}

@@ -123,0 +135,0 @@

{
"name": "cross-spawn",
"version": "3.0.1",
"version": "4.0.0",
"description": "Cross platform child_process#spawn and child_process#spawnSync",

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

@@ -56,3 +56,10 @@ # cross-spawn

## Caveat
On Windows, cross-spawn will only spawn `cmd.exe` if necessary. If the extension
of the executable is `.exe` or `.com`, it will spawn it directly. If you wish
to override this behavior and *always* spawn a shell, pass the `{shell: true}`
option.
## Tests

@@ -59,0 +66,0 @@

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