-
Notifications
You must be signed in to change notification settings - Fork 343
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
Conversation
The fs.readSync function throws EOF instead of returning 0 like in other systems. See nodejs/node#35997 for more information.
@@ -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 |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
* 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 <[email protected]> Co-authored-by: Casper da Costa-Luis <[email protected]>
The fs.readSync function throws EOF instead of returning 0 like in other systems.
See nodejs/node#35997 for more information.