Skip to content

Provide a way to redirect stdout/stderr into a file #5511

@ash2k

Description

@ash2k

Description of the problem / feature request:

It is common for programs in unix world to output the result of an invocation to stdout. The current way to capture that output is to either use ctx.actions.run_shell() or a wrapping shell script to redirect it to a file. This requires spawning an extra process and hence adds some overhead. Perhaps it makes sense to provide a way for ctx.actions.run() to redirect stdout and/or stderr into a file.

Feature requests: what underlying problem are you trying to solve with this feature?

I have a tool that does what I described above - writes the result of its invocation to stdout. I need to capture that output and put it into a file - it is the output of the rule. Currently I have to wrap it in a shell script and I thought it might be good to suggest this feature. Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3We're not considering working on this, but happy to review a PR. (No assignee)not staleIssues or PRs that are inactive but not considered staleteam-Rules-APIAPI for writing rules/aspects: providers, runfiles, actions, artifactstype: feature request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions