cross-spawn
Advanced tools
Comparing version 0.2.9 to 0.3.0
15
index.js
@@ -78,3 +78,3 @@ var fs = require('fs'); | ||
function spawn(command, args, options) { | ||
function spawnInternal(method, command, args, options) { | ||
var applyQuotes; | ||
@@ -88,3 +88,3 @@ var shebang; | ||
if (!isWin) { | ||
return cp.spawn(command, args, options); | ||
return cp[method](command, args, options); | ||
} | ||
@@ -113,6 +113,15 @@ | ||
return cp.spawn(command, args, options); | ||
return cp[method](command, args, options); | ||
} | ||
function spawn(command, args, options) { | ||
return spawnInternal('spawn', command, args, options); | ||
} | ||
function spawnSync(command, args, options) { | ||
return spawnInternal('spawnSync', command, args, options); | ||
} | ||
module.exports = spawn; | ||
module.exports.spawn = spawn; | ||
module.exports.sync = spawnSync; |
{ | ||
"name": "cross-spawn", | ||
"version": "0.2.9", | ||
"version": "0.3.0", | ||
"description": "Cross platform child_process#spawn", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -18,2 +18,3 @@ # cross-spawn [![Build Status](https://travis-ci.org/IndigoUnited/node-cross-spawn.svg?branch=master)](https://travis-ci.org/IndigoUnited/node-cross-spawn) | ||
- It does not allow you to run `del` or `dir` | ||
- It does not properly escape arguments with spaces or special characters | ||
@@ -26,5 +27,15 @@ All these issues are handled correctly by `cross-spawn`. | ||
Exactly the same way as node's spawn, so it's a drop in replacement. | ||
Exactly the same way as node's [`spawn`](https://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options) or [`spawnSync`](https://nodejs.org/api/child_process.html#child_process_child_process_spawnsync_command_args_options), so it's a drop in replacement. Note that the sync version is only available in `node >= 0.12`. | ||
```javascript | ||
var spawn = require('cross-spawn'); | ||
// Spawn NPM asynchronously | ||
var process = spawn('npm', ['list', '-g', '-depth' '0'], { stdio: 'inherit' }); | ||
// Spawn NPM synchronously | ||
var results = spawn.sync('npm', ['list', '-g', '-depth' '0'], { stdio: 'inherit' }); | ||
``` | ||
## Tests | ||
@@ -31,0 +42,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8302
97
47