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

IO::Handle.Supply.lines blocks on buffer. #5189

Open
Leont opened this issue Feb 5, 2023 · 0 comments · May be fixed by #5270
Open

IO::Handle.Supply.lines blocks on buffer. #5189

Leont opened this issue Feb 5, 2023 · 0 comments · May be fixed by #5270

Comments

@Leont
Copy link
Contributor

Leont commented Feb 5, 2023

The Problem

When turning an IO::Handle into a stream using .Supply, the resulting supply isn't usable when chain with for example .lines or .words.

Expected Behavior

Lines/words are read as they come in.

Actual Behavior

No lines are processed until the entire buffer (64k by default) is filled (or EOF is reached). This can be worked around, by setting the blocksize to 1 byte, but that is highly unintuitive and performs poorly.

What .Supply probably should do instead is read up to $blocksize bytes.

Steps to Reproduce

react { whenever $*IN.Supply.lines { say $_ } }

Environment

Welcome to Rakudo™ v2022.12.
Implementing the Raku® Programming Language v6.d.
Built on MoarVM version 2022.12.
Leont added a commit to Leont/rakudo that referenced this issue Jun 4, 2023
Otherwise it will only emit any data once 64k bytes are read, which
means a construct like $handle.Supply.lines will not DWIM at all.

This fixes rakudo#5189
@Leont Leont linked a pull request Jun 4, 2023 that will close this issue
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 a pull request may close this issue.

1 participant