Package Exports
- parallelshell
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (parallelshell) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Parallel Shell
This is a super simple npm module to run shell commands in parallel. All processes will share the same stdout/stderr, and if any command exits with a non-zero exit status, the rest are stopped and the exit code carries through.
Version compatibility notes
- v2.0.0 is compatible with Node < 8
- v3.x.x is compatible with Node >= 8
Maintenance has been resumed by @darkguy2008. However, there are also better options, see Consolidation of multiple similar libraries.
Motivation
How is this different than:
$ cmd1 & cmd2 & cmd3Cross platform -- works on Unix or Windows.
&creates a background process, which only exits if you kill it or it ends.parallelshellwill autokill processes if one of the others dies.command1 & command2 & command3will wait in the terminal until command3 ends only. parallelshell will wait until all 3 end.If command1 or command2 exit with non-zero exit code, then this will not effect the outcome of your shell (i.e. they can fail and npm/bash/whatever will ignore it).
parallelshellwill not ignore it, and will exit with the first non-zero exit code.Pressing Ctrl+C will exit command3 but not 1 or 2.
parallelshellwill exit all 3parallelshelloutputs all jobs stdout/err to its stdout/err. background jobs do that... kind of coincidentally (read: unreliably)
Install
Simply run the following to install this to your project:
npm i --save-dev parallelshellOr, to install it globally, run:
npm i -g parallelshellUsage
To use the command, simply call it with a set of strings - which correspond to shell arguments, for example:
parallelshell "echo 1" "echo 2" "echo 3"This will execute the commands echo 1 echo 2 and echo 3 simultaneously.
Note that on Windows, you need to use double-quotes to avoid confusing the argument parser.
Available options:
-h, --help output usage information
-v, --verbose verbose logging
-w, --wait will not close sibling processes on error