Skip to content

Commit

Permalink
Minor CS.
Browse files Browse the repository at this point in the history
  • Loading branch information
satazor committed May 6, 2015
1 parent 2cedb5f commit 768848a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .jshintrc
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"es5": false,
"esnext": false,
"evil": false,
"expr": false,
"expr": true,
"funcscope": false,
"globalstrict": false,
"iterator": false,
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@ There are some known modules, such as [win-spawn](https://github.com/ForbesLinde

## Usage

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.
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");
var spawn = require('cross-spawn');

// Spawn NPM asynchronously
var process = spawn("npm", ["list", "-g", "-depth" "0"], {stdio: "inherit"});
var process = spawn('npm', ['list', '-g', '-depth' '0'], { stdio: 'inherit' });

// Spawn NPM synchronously
var results = spawn.sync("npm", ["list", "-g", "-depth" "0"], {stdio: "inherit"});
var results = spawn.sync('npm', ['list', '-g', '-depth' '0'], { stdio: 'inherit' });
```


Expand Down
12 changes: 8 additions & 4 deletions test/util/buffered.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
var spawn = require('../../index');

function buffered(method, command, args, options, callback) {
var cp;
var data;
var results;

if (typeof options === 'function') {
callback = options;
options = null;
Expand All @@ -13,13 +17,13 @@ function buffered(method, command, args, options, callback) {
args = options = null;
}

if (method === 'sync') {
var results = spawn.sync(command, args, options);
if (method === 'spawnSync') {

This comment has been minimized.

Copy link
@Glavin001

Glavin001 Jun 15, 2015

I believe this broke testing for sync, as in test.js it is called method sync and not spawnSync. I'll fix this with my Pull Request for #16.

results = spawn.sync(command, args, options);
callback(results.error, results.stdout.toString(), results.status);
}
else {
var cp = spawn(command, args, options);
var data = '';
cp = spawn(command, args, options);
data = '';

cp.stdout.on('data', function(buffer) {
data += buffer.toString();
Expand Down

0 comments on commit 768848a

Please sign in to comment.