Skip to content
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

stdout/stderr with 'inherit' + transform should not capture output #1125

Closed
bcoughlan opened this issue Jun 17, 2024 · 3 comments
Closed

stdout/stderr with 'inherit' + transform should not capture output #1125

bcoughlan opened this issue Jun 17, 2024 · 3 comments

Comments

@bcoughlan
Copy link

#121 implemented the ability to transform stdout/stderr while using inherit. However the output is captured, like pipe mode, which is a source of memory leaks for long running processes.

Example:

import { execa } from 'execa';

async function main() {
    await execa({
        stdout: [function* (line) {
            yield `[test] ${line}`;
        }, 'inherit'],
        stderr: [function* (line) {
            yield `[test] ${line}`;
        }, 'inherit'],
    })('sh', ['ls', '-la', '/bad'])
}

main()

Expected: thrown error does not contain stdio or stderr properties.

Actual: output includes...

  stderr: '[test] /bin/ls: /bin/ls: cannot execute binary file',
  stdio: [
    undefined,
    '',
    '[test] /bin/ls: /bin/ls: cannot execute binary file'
  ],
@ehmicky
Copy link
Collaborator

ehmicky commented Jun 18, 2024

Hi @bcoughlan,

Thanks for reaching out.

To avoid capturing output, the buffer option must be set to false.

@bcoughlan
Copy link
Author

Thank you so much, that worked. Apologies for the noise.

@wtto00

This comment was marked as off-topic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants