2.3.7 • Published 4 years ago

concurrent-run v2.3.7

Weekly downloads
6
License
MIT
Repository
github
Last release
4 years ago

concurrent-run · npm Build Status

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

Installation

npm

npm install --save-dev concurrent-run

Yarn

yarn add --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

import { ConcurrentRun, Command } from "concurrent-run";

const concurrent = new ConcurrentRun();

concurrent
	.run(["command1 arg", "command2 arg"])
	.on("data", (data: Buffer, command: Command) => {
		// data from spawned process stderr and stdout
	})
	.on("close", (exitCode: number, command: Command) => {
		// after command is finished
	})
	.on("error", (err: Error, command: Command) => {
		// after an error occurs
	});

Events

  • data gets called once stderr or stdout of spawned process sends data.
import { ConcurrentRun, Command } from "concurrent-run";

const concurrent = new ConcurrentRun();

concurrent
	.run(["command1 arg"])
	.on("data", (data: Buffer, command: Command) => {
		// do something...
	});
  • close gets called once command is finished.
import { ConcurrentRun, Command } from "concurrent-run";

const concurrent = new ConcurrentRun();

concurrent
	.run(["command1 arg"])
	.on("close", (exitCode: number, command: Command) => {
		// do something...
	});
  • error gets called once an error occurs.
import { ConcurrentRun, Command } from "concurrent-run";

const concurrent = new ConcurrentRun();

concurrent
	.run(["command1 arg"])
	.on("error", (err: Error, command: Command) => {
	// do something...
});

Contributing

Feel free to open issues or PRs!

2.3.7

4 years ago

2.3.6

4 years ago

2.3.5

4 years ago

2.3.4

4 years ago

2.3.3

4 years ago

2.3.2

4 years ago

2.3.0

4 years ago

2.3.1

4 years ago

2.2.3

5 years ago

2.2.2

5 years ago

2.2.1

5 years ago

2.2.0

5 years ago

2.1.0

5 years ago

2.0.0

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago