-
-
Notifications
You must be signed in to change notification settings - Fork 229
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ability to prefix child process stdio lines with a custom string #121
Comments
It's not possible to intercept the stdout/stderr when you're using |
Can't we just reimplement |
Relevant Node.js issue: nodejs/node#8033 |
Re-opening because this feature still depends on #695. |
PR at #699 implementing this. The initial message's example would then written as: const prefixLine = function * (line) {
yield `[job ${i + 1} of jobs.length] ${line}`
}
await Promise.all(jobs.map((job, i) => execa(
job.cmd,
job.args,
{ stdout: ['inherit', prefixLine] },
))) |
This feature has been just released in Execa 9.0.0. Please see (and share!) the release post and the changelog. |
Proposal: add a new option
prefix
(optional, string). If given, the child's stdout and stderr streams would be transformed so each line is prefixed with the given string.Use case: when running several child processes in parallel and using
inherit
to pipe each child's stdio to the parent, prefixing would make it easier to see what's going on:I think the best API would be to have a
prefix
option which would apply to both stdout and stderr streams, and alsoprefixStdout
andprefixStderr
in case you want to override them individually.Happy to implement this if interested.
The text was updated successfully, but these errors were encountered: