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::Async running with yes command returns superfluous output and hangs #6584

Closed
p6rt opened this issue Oct 8, 2017 · 7 comments
Closed
Labels

Comments

@p6rt
Copy link

p6rt commented Oct 8, 2017

Migrated from rt.perl.org#132242 (status was 'rejected')

Searchable as RT132242$

@p6rt
Copy link
Author

p6rt commented Oct 8, 2017

From @titsuki

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.

$ perl6 --version
This is Rakudo version 2017.09-254-gde0533c4d built on MoarVM version 2017.09.1-575-gd4e230a69
implementing Perl 6.c.

@p6rt
Copy link
Author

p6rt commented Oct 8, 2017

From @geekosaur

On Sat, Oct 7, 2017 at 10​:21 PM, Itsuki Toyota <perl6-bugs-followup@​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

--
brandon s allbery kf8nh sine nomine associates
allbery.b@​gmail.com ballbery@​sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net

@p6rt
Copy link
Author

p6rt commented Oct 8, 2017

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Oct 8, 2017

From @AlexDaniel

I created this doc issue​: Raku/doc#1591

On 2017-10-07 19​:33​:40, allbery.b@​gmail.com wrote​:

On Sat, Oct 7, 2017 at 10​:21 PM, Itsuki Toyota <perl6-bugs-followup@​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

@p6rt
Copy link
Author

p6rt commented Oct 9, 2017

From @jnthn

On Sat, 07 Oct 2017 19​:33​:40 -0700, allbery.b@​gmail.com wrote​:

On Sat, Oct 7, 2017 at 10​:21 PM, Itsuki Toyota <perl6-bugs-followup@​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.

@p6rt
Copy link
Author

p6rt commented Oct 10, 2017

From @AlexDaniel

I'll close this in favor of the doc issue mentioned above.

I'm pretty sure this needs a corresponding [DETRAP] ticket, but that tag is not a thing *yet*. For now we only document these things. Eventually I'll get to it, but this a long-term thingie (like v6.d or v6.e or whatever).

On 2017-10-09 01​:27​:33, jnthn@​jnthn.net wrote​:

On Sat, 07 Oct 2017 19​:33​:40 -0700, allbery.b@​gmail.com wrote​:

On Sat, Oct 7, 2017 at 10​:21 PM, Itsuki Toyota <perl6-bugs-
followup@​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.

@p6rt
Copy link
Author

p6rt commented Oct 10, 2017

@AlexDaniel - Status changed from 'open' to 'rejected'

@p6rt p6rt closed this as completed Oct 10, 2017
@p6rt p6rt added the Bug label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant