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(fslib): match node behaviour in fs.read on Windows #3049

Merged
merged 3 commits into from
Jun 30, 2021

Conversation

merceyz
Copy link
Member

@merceyz merceyz commented Jun 27, 2021

What's the problem this PR addresses?

When calling fs.read(0, ...) on Windows after stdin is closed Node calls the callback with an EOF error but still provides bytesRead and buffer, with PnP only the error is provided.

Ref nodejs/node#35997
Fixes #3045

How did you fix it?

Match the node behaviour and provide both bytesRead and buffer on EOF errors on Windows

Checklist

  • I have read the Contributing Guide.
  • I have set the packages that need to be released for my changes to be effective.
  • I will check that all automated PR checks pass before the PR gets reviewed.

@merceyz merceyz force-pushed the merceyz/fix/pnp-bytesRead-windows branch from 03f350c to 5f33fab Compare June 27, 2021 14:25
@merceyz merceyz force-pushed the merceyz/fix/pnp-bytesRead-windows branch from 5f33fab to b53c184 Compare June 28, 2021 09:33
@arcanis
Copy link
Member

arcanis commented Jun 28, 2021

Looking at the Node sources it seems that bytesRead is actually set on all platforms (and all errors). Do you agree with my change @merceyz?

@merceyz
Copy link
Member Author

merceyz commented Jun 28, 2021

Ah, perfect, no branching required 👍

@arcanis arcanis merged commit c125c02 into master Jun 30, 2021
@arcanis arcanis deleted the merceyz/fix/pnp-bytesRead-windows branch June 30, 2021 15:35
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.

[Bug] Panic/Error while building plugin from source
2 participants