allelify
v1.0.2
Published
Parallelize commands and write logs to reasonable files in background.
Downloads
1
Maintainers
Readme
allelify
require("allelify")([
"make test",
{
title: "lint",
command: "make lint",
},
{
title: "snarglify",
command: "ag",
args: ["-l", "build steps"],
},
]);
npm install -g allelify
allelify 'make lint' 'sleep 1' 'make test'
For build steps, I often want a simple way to run commands in parallel while preserving clear logs that aren't muddled together from multiple processes. allelify
does just that.
Most of the logic for this comes from spinnies—this is a minimal wrapper that handles logs, parallelization, and errors.
- By default, this writes log files to /tmp. You can specify a different directory by adding a second argument to
allelify
—allelify(commands, { tmpDirectory: path.join(__dirname, "../tmp") })
. - This uses
child_process.spawn
to start a child process. This allows it to handle processes with large amounts of logs, but has the drawback that shell-redirects and pipes don't work. Additionally, it means that to specify command lines arguments with spaces, you'll need to use the{ title, command, args }
syntax—it's not doing any fancy parsing to figure out what args to pass tospawn
.