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

$proc.stdout is shorter than $proc.stdout.lines but most of the times is useless (trap) #1591

Closed
AlexDaniel opened this issue Oct 8, 2017 · 2 comments
Labels
docs Documentation issue (primary issue type) trap

Comments

@AlexDaniel
Copy link
Member

See RT #132242. Basically, most users want .stdout.lines instead of .stdout, but for some reason it is not obvious. I've done this myself in the past.

@AlexDaniel AlexDaniel added the docs Documentation issue (primary issue type) label Oct 8, 2017
@jnthn
Copy link
Contributor

jnthn commented Oct 9, 2017

I've probably used Proc::Async as much as anyone, and a large number of times I actually was after the entire output, and whenever $p.stdout { $out ~= $_ } works totally fine for that case (and is potentially a lot more efficient than breaking it up into lines, if the thing writing the output uses output buffering). But yes, should document this clearly on the stdout/stderr methods that this is an asynchronous API, and will give you the data as it arrives, in the chunks it arrives in.

@AlexDaniel
Copy link
Member Author

AlexDaniel commented Oct 9, 2017

Huh. Yes, you were after the entire output, not chunks. This only tells me that we're maybe missing Supply.join. You can already do $p.stdout.reduce(*~*) but that's kinda meh.

In my naïve view of a perfect world, we could have had tapping on .stdout return an error message that suggested .lines, .join or .pass-thru, where .pass-thru would return the same supply but with the check disabled (so that you can tap on chunks if you really want to). This would make both .lines and .join behavior equally easy (or so), and will help people avoid the trap due to huffman coding. Ta-daa.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation issue (primary issue type) trap
Projects
None yet
Development

No branches or pull requests

2 participants