A cross platform solution to node's spawn and spawnSync.
$ npm install cross-spawn
If you are using
spawnSync on node 0.10 or older, you will also need to install
$ npm install spawn-sync
Node has issues when using spawn on Windows:
- It ignores PATHEXT
- It does not support shebangs
- It does not allow you to run
- It does not properly escape arguments with spaces or special characters
All these issues are handled correctly by
There are some known modules, such as win-spawn, that try to solve this but they are either broken or provide faulty escaping of shell arguments.
var spawn = ;// Spawn NPM asynchronouslyvar child = ;// Spawn NPM synchronouslyvar results = spawn;
On Windows, cross-spawn will only spawn
cmd.exe if necessary. If the extension
of the executable is
.com, it will spawn it directly. If you wish
to override this behavior and always spawn a shell, pass the
$ npm test
Released under the MIT License.