On Sat, 07 Oct 2017 19:33:40 -0700, allber...@gmail.com wrote: > On Sat, Oct 7, 2017 at 10:21 PM, Itsuki Toyota <perl6-bugs-follo...@perl.org > > wrote: > > > See the following result: > > > > $ perl6 -e 'my $proc = Proc::Async.new("yes"); > > $proc.stdout.head(1).tap(&say); await $proc.start;' > > > > y > > y > > y > > y > > y > > y > > y > > y > > ... > > > > > > I think tap(&say) should output just a 'y' char and completes its work. > > > > No guarantee it's line based, nor do pipes deliver output in lines. You > wanted a .lines in there to 'rechunk' the output; otherwise I suspect you > get blocks based on the size of am OS pipe buffer, or similar. > > https://docs.perl6.org/type/Supply#method_lines >
Indeed; the Supply objects returned from Proc::Async just pass on the data that arrives, as it arrives, in the chunks that it arrives in. Often one wants all of the output, so parsing it into lines by default would just add a load of overhead to that case. The `.lines` method is the correct way for those wanting line-by-line output.