Skip to content

Print command output and get the output in results #51

@gperdomor

Description

@gperdomor

Hi all... Thank you for this lib :D...

I ha ve doubt, how can I run a long run command, for example docker build, print the logs on terminal but at the same time getting the complete output to be evaluated later?...

Case 1:
const result = await exec('docker', ['buildx', 'build', '....'])
This works fine and I get the stderr, stdout, and exitCode inside result variable, and I can do a console log to print the output using console.log, but because the command takes a while, it's a bad experience because the user can't see the progress while the command runs...

Case 2:
const res = await exec('docker', ['buildx', 'build', '....'], {nodeOptions: { stdio: 'inherit' }})
With stdio: 'inherit' I can see the progress in realtime but stderr and stdout are always empty strings in the result variable, so cannot be used for extra analysis of the output...

I want to print the progress in realtime but also get the complete output in the result variable... How can I do that?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions