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

Fix pipe reading logic on Windows #516

Merged
merged 1 commit into from
May 18, 2021
Merged

Conversation

0x2b3bfa0
Copy link
Member

The fs.readSync function throws EOF instead of returning 0 like in other systems.
See nodejs/node#35997 for more information.

The fs.readSync function throws EOF instead of returning 0 like in other systems.
See nodejs/node#35997 for more information.
@0x2b3bfa0 0x2b3bfa0 added the bug Something isn't working label May 14, 2021
@0x2b3bfa0 0x2b3bfa0 requested a review from casperdcl May 14, 2021 19:18
@0x2b3bfa0 0x2b3bfa0 self-assigned this May 14, 2021
@@ -24,6 +24,7 @@ module.exports.load = (format) => {

chunks.push(buffer.slice(0, nbytes));
} catch (err) {
if (err.code === 'EOF') break; // HACK: see nodejs/node#35997
Copy link
Contributor

Choose a reason for hiding this comment

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

should really try-catch just line 21? Also could the error be thrown even though nbytes != 0?

Copy link
Member Author

Choose a reason for hiding this comment

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

should really try-catch just line 21

Maybe, though I'm not sure about which line would throw EAGAIN under normal conditions (?)

Also could the error be thrown even though nbytes != 0?

I don't think so: it just happens when you attempt a read and there are 0 bytes left.

Copy link
Contributor

Choose a reason for hiding this comment

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

If we're sure EOF only gets raised when no bytes are left, then this is fine

@@ -24,6 +24,7 @@ module.exports.load = (format) => {

chunks.push(buffer.slice(0, nbytes));
} catch (err) {
if (err.code === 'EOF') break; // HACK: see nodejs/node#35997
Copy link
Contributor

Choose a reason for hiding this comment

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

If we're sure EOF only gets raised when no bytes are left, then this is fine

@0x2b3bfa0 0x2b3bfa0 closed this May 17, 2021
@0x2b3bfa0 0x2b3bfa0 reopened this May 17, 2021
@0x2b3bfa0 0x2b3bfa0 temporarily deployed to test-internal May 17, 2021 15:18 Inactive
@DavidGOrtega DavidGOrtega changed the base branch from master to release/v0.4.0 May 18, 2021 23:36
@DavidGOrtega DavidGOrtega merged commit d5de793 into release/v0.4.0 May 18, 2021
@DavidGOrtega DavidGOrtega deleted the i-hate-windows branch May 18, 2021 23:37
DavidGOrtega added a commit that referenced this pull request May 19, 2021
* No await runner (#523)

* cml-publish mime and repo (#519)

* cml-publish mime and repo

* cleanup

* image/svg+xml

* buffer

* resolve

* text buffer outputs plain

* native bolean

* snapshot

* Fix pipe reading logic on Windows (#516)

The fs.readSync function throws EOF instead of returning 0 like in other systems.
See nodejs/node#35997 for more information.

* minor doc fixes (#534)

* cml-pr command (#510)

* test-cml-pr

* packages

* pre-release

* log isci

* log isci

* user_name

* log gitlab url

* log gitlab url

* short 8

* len paths

* no undef

* git

* files

* files

* files

* files

* files

* files

* files

* files

* files

* files

* files

* files

* files

* files

* files

* files

* files

* sha2

* sha2

* log filepath

* log filepath

* log filepath

* exists and  clean

* SHA vs SHA2

* pre-release

* pre-release 2

* pre-release 3

* pre-release 3

* pre-release 3

* pre-release 3

* pre-release 3

* pre-release 3

* git back

* git back

* git back

* release

* REPO_TOKEN

* html_url

* cml pr defaults

* cml pr defaults

* test strict again

* CI

* vars

* shorter params

* snapshots and olivaw

* test david

* BB fix

* snapshots

* No git sha dependencies (#517)

* check head_sha

* 0.4.0

Co-authored-by: Helio Machado <0x2b3bfa0+git@googlemail.com>
Co-authored-by: Casper da Costa-Luis <work@cdcl.ml>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants