Skip to content

[command]… output is prepended to exec outStream #649

@Swatinem

Description

@Swatinem

Describe the bug
I want to redirect a commands output to a file, but I still want the command that I execute to be logged.
Currently the [command]… log is streamed into the outStream, and not to stdout as I would expect.

To Reproduce
Steps to reproduce the behavior:

await exec.exec("echo", ["foobar"], { outStream: fs.createWriteStream("foobar.txt") });

Expected behavior
I want the foobar.txt file to only have foobar in it.
Instead, it will have the [command]echo foobar command output prepended.

Additional context

Not quite sure if this is intentional?

if (!optionsNonNull.silent && optionsNonNull.outStream) {
optionsNonNull.outStream.write(
this._getCommandString(optionsNonNull) + os.EOL
)
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions