Cross-platform command-line utility for executing multiple shell commands in parallel with automatic process cleanup and proper exit code propagation
npx @tessl/cli install tessl/npm-parallelshell@3.0.0Parallelshell is a cross-platform command-line utility for executing multiple shell commands in parallel with automatic process cleanup, proper exit code propagation, and graceful termination. It provides better reliability and control than traditional shell job control mechanisms.
npm install -g parallelshell or npm install --save-dev parallelshell./index.js (executable script)index.jsParallelshell is a CLI binary, not a programmatic API. It's accessed via command line execution:
# Direct execution (global install)
parallelshell "command1" "command2" "command3"
# Via npx (local install)
npx parallelshell "npm run server" "npm run client"
# In npm scripts
"scripts": {
"dev": "parallelshell \"npm run api\" \"npm run ui\""
}# Run multiple development servers
parallelshell "npm run api-server" "npm run webpack-dev-server" "npm run sass-watch"
# Run tests in parallel
parallelshell "npm run test:unit" "npm run test:integration" "npm run lint"
# With options
parallelshell --verbose --wait "long-running-task" "another-task"Executes multiple shell commands simultaneously with cross-platform compatibility.
parallelshell [options] <command1> <command2> ... <commandN>CLI Signature:
parallelshell: Main executable command[options]: Optional flags (-h, -v, -w and their long forms)<command1> <command2> ... <commandN>: Shell commands to execute in parallel (quoted strings)Arguments:
command1, command2, ...commandN (string): Shell commands to execute in parallel (must be quoted on Windows)Displays usage information and exits.
parallelshell -h
parallelshell --helpOutput:
-h, --help output usage information
-v, --verbose verbose logging
-w, --wait will not close sibling processes on errorEnables detailed logging of process status and lifecycle events.
parallelshell -v [commands...]
parallelshell --verbose [commands...]Behavior:
<command> ended successfully"<command> failed with exit code <code>"<command> will now be closed"Prevents automatic termination of sibling processes when one process fails.
parallelshell -w [commands...]
parallelshell --wait [commands...]Behavior:
--wait, other processes continue running even if siblings failDefault Behavior:
--wait optionSIGINT (Ctrl+C) Handling:
Process Creation Details:
child_process.spawn() with shell command executionprocess.env)Exit Code Behavior:
Windows:
cmd /c for command executionUnix/Linux/macOS:
sh -c with exec prefix for command executionexec to ensure proper process replacementNode.js Version Compatibility:
process.cwd behaviorprocess.cwd() method for working directory handlingStandard Output/Error:
# Start development environment
parallelshell "npm run api" "npm run ui" "npm run docs"
# With verbose logging for debugging
parallelshell --verbose "npm start" "npm run watch:css" "npm run watch:js"# Fail fast (default behavior)
parallelshell "npm run test" "npm run lint" "npm run type-check"
# Continue on failure to collect all results
parallelshell --wait "npm run test" "npm run lint" "npm run security-audit"# Windows requires double quotes
parallelshell "npm run server" "npm run client"
# Unix/Linux can use single or double quotes
parallelshell 'npm run server' 'npm run client'Single Process Failure (Default):
Process Failure with --wait:
npm install -g parallelshellUse directly from command line:
parallelshell "echo hello" "echo world"npm install --save-dev parallelshellUse in npm scripts:
{
"scripts": {
"dev": "parallelshell \"npm run api\" \"npm run ui\"",
"test:all": "parallelshell \"npm run test:unit\" \"npm run test:e2e\""
}
}Use with npx:
npx parallelshell "command1" "command2"&)Parallelshell advantages:
Parallelshell advantages:
GNU Parallel advantages: