8000 output: make StreamLines accept string instead of bytes by bobheadxi · Pull Request #41 · sourcegraph/run · GitHub
[go: up one dir, main page]

Skip to content

Conversation

@bobheadxi
Copy link
Member
@bobheadxi bobheadxi commented Jun 6, 2022

The main intent is to allow command output to be streamed to lib/output.Output, e.g.

cmd.Run(ctx, `brew install git`).StreamLines(std.Out.Write)
cmd.Run(ctx, `brew install git`).StreamLines(std.Out.Verbose)

I was originally going to add this to lib/output, e.g. https://github.com/sourcegraph/sourcegraph/pull/36594, but I stumbled across Pending and output.Writer (linked above). The integration is probably neater by changing the interface here - besides, if you're getting data line-by-line then you're probably already thinking in terms of processed data (strings) anyway.

Context: experimenting with https://github.com/sourcegraph/sourcegraph/pull/36556 and thinking we can have each Action be provided pending for neater output. pending implements only the Writer interface

@bobheadxi bobheadxi requested a review from michaellzc as a code owner June 6, 2022 21:01
@bobheadxi bobheadxi requested a review from a team June 6, 2022 21:01
@bobheadxi bobheadxi merged commit e72b3f8 into main Jun 7, 2022
@bobheadxi bobheadxi deleted the stream-lines-string branch June 7, 2022 23:17
bobheadxi added a commit to sourcegraph/sourcegraph-public-snapshot that referenced this pull request Jun 8, 2022
Revert "lib/output: add WriteBytes convenience function (#36594)"

This reverts commit 43ec313, in favour of sourcegraph/run#41
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

Successfully merging this pull request may close these issues.

2 participants

0