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

win-fork

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

win-fork - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

bin/win-spawn

45

index.js

@@ -6,7 +6,44 @@ var cSpawn = require('child_process').spawn;

function spawn(command, args, options) {
if (os === 'Windows_NT') {
args = [command].concat(args);
command = process.execPath;
if (os === 'Windows_NT') {
args = args || [];
options = options || {};
var match, matchA;
if (matchA = /((?:[A-Z_]+\=[^ \=]+ )+)?([^\r\n]+)/.exec(command)) {
try {
var file = require('fs').readFileSync(matchA[2], 'utf8');
if (match = /\#\!\/usr\/bin\/env ([^\r\n]+)/.exec(file)) {
args.unshift(matchA[2]);
command = matchA[1] + match[1];
}
} catch (ex) { }
}
return cSpawn(command, args, options);
if (match = /((?:[A-Z_]+\=[^ \=]+ )+)([^\r\n]+)/.exec(command)) {
command = match[2];
options.env = options.env || shallowClone(process.env);
var env = match[1].split(' ');
env.forEach(function (v) {
v = v.split('=');
if (v.length === 2) {
options.env[v[0]] = v[1];
}
});
}
args.unshift(command);
args.unshift('/c');
command = 'cmd';
}
return cSpawn(command, args, options);
}
function shallowClone(obj) {
var out = {};
Object.keys(obj)
.forEach(function (key) {
out[key] = obj[key];
});
return out;
}

11

package.json
{
"name": "win-fork",
"version": "1.0.0",
"version": "1.0.1",
"description": "Spawn for node.js but in a way that works regardless of which OS you're using",
"main": "index.js",
"scripts": {
"test": "mocha"
},
"repository": {

@@ -13,4 +10,8 @@ "type": "git",

},
"author": "",
"bin": {
"win-spawn": "./bin/win-spawn",
"win-fork": "./bin/win-spawn"
},
"author": "ForbesLindesay",
"license": "BSD"
}
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