Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/moxystudio/node-cross-spawn
A cross platform solution to node's spawn and spawnSync
https://github.com/moxystudio/node-cross-spawn
cmd cross-platform exec path-ext shebang spawn windows
Last synced: 5 days ago
JSON representation
A cross platform solution to node's spawn and spawnSync
- Host: GitHub
- URL: https://github.com/moxystudio/node-cross-spawn
- Owner: moxystudio
- License: mit
- Created: 2014-06-30T01:03:58.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2024-11-18T14:20:54.000Z (2 months ago)
- Last Synced: 2025-01-14T01:02:11.648Z (12 days ago)
- Topics: cmd, cross-platform, exec, path-ext, shebang, spawn, windows
- Language: JavaScript
- Homepage:
- Size: 987 KB
- Stars: 1,112
- Watchers: 22
- Forks: 104
- Open Issues: 24
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- awesome-cross-platform-nodejs - cross-spawn - Cross-platform implementation of `child_process.spawn()`. (Libraries / Shell)
- awesome-github-star - node-cross-spawn
README
# cross-spawn
[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][ci-image]][ci-url] [![Build status][appveyor-image]][appveyor-url]
[npm-url]:https://npmjs.org/package/cross-spawn
[downloads-image]:https://img.shields.io/npm/dm/cross-spawn.svg
[npm-image]:https://img.shields.io/npm/v/cross-spawn.svg
[ci-url]:https://github.com/moxystudio/node-cross-spawn/actions/workflows/ci.yaml
[ci-image]:https://github.com/moxystudio/node-cross-spawn/actions/workflows/ci.yaml/badge.svg
[appveyor-url]:https://ci.appveyor.com/project/satazor/node-cross-spawn
[appveyor-image]:https://img.shields.io/appveyor/ci/satazor/node-cross-spawn/master.svgA cross platform solution to node's spawn and spawnSync.
## Installation
Node.js version 8 and up:
`$ npm install cross-spawn`Node.js version 7 and under:
`$ npm install cross-spawn@6`## Why
Node has issues when using spawn on Windows:
- It ignores [PATHEXT](https://github.com/joyent/node/issues/2318)
- It does not support [shebangs](https://en.wikipedia.org/wiki/Shebang_(Unix))
- Has problems running commands with [spaces](https://github.com/nodejs/node/issues/7367)
- Has problems running commands with posix relative paths (e.g.: `./my-folder/my-executable`)
- Has an [issue](https://github.com/moxystudio/node-cross-spawn/issues/82) with command shims (files in `node_modules/.bin/`), where arguments with quotes and parenthesis would result in [invalid syntax error](https://github.com/moxystudio/node-cross-spawn/blob/e77b8f22a416db46b6196767bcd35601d7e11d54/test/index.test.js#L149)
- No `options.shell` support on node `` where `` must not contain any arguments.
If you would like to have the shebang support improved, feel free to contribute via a pull-request.Remember to always test your code on Windows!
## Tests
`$ npm test`
`$ npm test -- --watch` during development## License
Released under the [MIT License](https://www.opensource.org/licenses/mit-license.php).