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

feature: allow reading into a 0-length array #3329

Merged
merged 4 commits into from
Dec 28, 2019
Merged

feature: allow reading into a 0-length array #3329

merged 4 commits into from
Dec 28, 2019

Conversation

qexk
Copy link
Contributor

@qexk qexk commented Nov 13, 2019

Fixes #3287
The Deno read* functions can now return 0 if the supplied buffer has no size. This doesn’t change the previous behaviour, it just adds a new return value.
I wrote one test in readNullBufferFailure in /cli/js/files_test.ts, but if you think it is useless or in the wrong function you can drop the second commit.

Fix #3287.
Mimic POSIX read() behaviour: if there is no bytes to read, return 0 and
do nothing.
Document the new behaviour.
@CLAassistant
Copy link

CLAassistant commented Nov 13, 2019

CLA assistant check
All committers have signed the CLA.

@bartlomieju bartlomieju requested a review from ry December 28, 2019 13:44
Copy link
Member

@ry ry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ry ry merged commit 4d4908d into denoland:master Dec 28, 2019
@qexk qexk deleted the feature/read-empty-array branch December 28, 2019 17:34
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.

Feature Request: Allow reading into a 0-length array
4 participants