3 [![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Build status][appveyor-image]][appveyor-url] [![Dependency status][david-dm-image]][david-dm-url] [![Dev Dependency status][david-dm-dev-image]][david-dm-dev-url]
5 [npm-url]:https://npmjs.org/package/cross-spawn
6 [downloads-image]:http://img.shields.io/npm/dm/cross-spawn.svg
7 [npm-image]:http://img.shields.io/npm/v/cross-spawn.svg
8 [travis-url]:https://travis-ci.org/IndigoUnited/node-cross-spawn
9 [travis-image]:http://img.shields.io/travis/IndigoUnited/node-cross-spawn/master.svg
10 [appveyor-url]:https://ci.appveyor.com/project/satazor/node-cross-spawn
11 [appveyor-image]:https://img.shields.io/appveyor/ci/satazor/node-cross-spawn/master.svg
12 [david-dm-url]:https://david-dm.org/IndigoUnited/node-cross-spawn
13 [david-dm-image]:https://img.shields.io/david/IndigoUnited/node-cross-spawn.svg
14 [david-dm-dev-url]:https://david-dm.org/IndigoUnited/node-cross-spawn#info=devDependencies
15 [david-dm-dev-image]:https://img.shields.io/david/dev/IndigoUnited/node-cross-spawn.svg
17 A cross platform solution to node's spawn and spawnSync.
22 `$ npm install cross-spawn`
24 If you are using `spawnSync` on node 0.10 or older, you will also need to install `spawn-sync`:
26 `$ npm install spawn-sync`
31 Node has issues when using spawn on Windows:
33 - It ignores [PATHEXT](https://github.com/joyent/node/issues/2318)
34 - It does not support [shebangs](http://pt.wikipedia.org/wiki/Shebang)
35 - It does not allow you to run `del` or `dir`
36 - It does not properly escape arguments with spaces or special characters
38 All these issues are handled correctly by `cross-spawn`.
39 There are some known modules, such as [win-spawn](https://github.com/ForbesLindesay/win-spawn), that try to solve this but they are either broken or provide faulty escaping of shell arguments.
44 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.
47 var spawn = require('cross-spawn');
49 // Spawn NPM asynchronously
50 var child = spawn('npm', ['list', '-g', '-depth', '0'], { stdio: 'inherit' });
52 // Spawn NPM synchronously
53 var results = spawn.sync('npm', ['list', '-g', '-depth', '0'], { stdio: 'inherit' });
64 Released under the [MIT License](http://www.opensource.org/licenses/mit-license.php).