Giter Site home page Giter Site logo

parallelshell's Introduction

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 & cmd3
  • Cross platform -- works on Unix or Windows.

  • & creates a background process, which only exits if you kill it or it ends. parallelshell will autokill processes if one of the others dies.

  • command1 & command2 & command3 will 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). parallelshell will not ignore it, and will exit with the first non-zero exit code.

  • Pressing Ctrl+C will exit command3 but not 1 or 2. parallelshell will exit all 3

  • parallelshell outputs 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 parallelshell

Or, to install it globally, run:

npm i -g parallelshell

Usage

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

parallelshell's People

Contributors

keithamus avatar paulpflug avatar darkguy2008 avatar chaines avatar eliias avatar jackysee avatar dracos avatar wayneashleyberry avatar nichoth avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.