Nihilist Postmodern Mistake
Learn how companies like Phone2Action are using npm in their front-end developmentJoin the conversation »

concurrent-run

2.2.3 • Public • Published

concurrent-run · npm Build Status

Simple, zero dependency, multiple commands runner in concurrent mode.

Installation

Yarn

yarn add --dev concurrent-run

npm

npm install --save-dev concurrent-run

Usage

CLI

concurrent-run "command1 arg" "command2 arg"

Always surround multiple commands with quotes, otherwise, everything will be treated as a single command.

API

const { ConcurrentRun } = require('concurrent-run');
const concurrent = new ConcurrentRun();
 
concurrent
  .run(['command1 arg', 'command2 arg'])
  .on('data', (data, command, index) => {
    // data from spawned process stderr and stdout
  })
  .on('close', (exitCode, command, index) => {
    // after command is finished
  })
  .on('error', (err, command, index) => {
    // after an error occurs
  });

Events

  • data gets called once stderr or stdout of spawned process sends data.
const concurrent = new ConcurrentRun();
concurrent.run(['command1 arg']).on('data', (data, command, index) => {
  // do something...
});
  • close gets called once command is finished.
const concurrent = new ConcurrentRun();
concurrent.run(['command1 arg']).on('close', (exitCode, command, index) => {
  // do something...
});
  • error gets called once an error occurs.
const concurrent = new ConcurrentRun();
concurrent.run(['command1 arg']).on('error', (err, command, index) => {
  // do something...
});

Contributing

Feel free to open issues or PRs!

Install

npm i concurrent-run

DownloadsWeekly Downloads

11

Version

2.2.3

License

MIT

Unpacked Size

15.8 kB

Total Files

11

Last publish

Collaborators

  • avatar