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(ext-tools): handle end of stream event #352

Merged
merged 1 commit into from
Oct 31, 2018
Merged

fix(ext-tools): handle end of stream event #352

merged 1 commit into from
Oct 31, 2018

Conversation

eysi09
Copy link
Collaborator

@eysi09 eysi09 commented Oct 31, 2018

When validating the hash of a downloaded binary, hash.read() returns
null at the end of stream event. This wasn't handled properly before.

When validating the hash of a downloaded binary, hash.read() returns
null at the end of stream event. This wasn't handled properly before.
@@ -171,6 +171,11 @@ export class BinaryCmd extends Cmd {
// validate sha256 if provided
const sha256 = hash.read()

// end of stream event
if (sha256 === null) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there any particular reason to check for null here instead of just a falsey value (e.g. if (sha256) {)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

According to the docs, stream.read() is explicitly null when the end-of-stream-reached event fires. So I figured it'd be safer to be explicit, a whole host of things can be falsey.

@eysi09 eysi09 merged commit fc50a8e into master Oct 31, 2018
@eysi09 eysi09 deleted the fix-ext-tools branch October 31, 2018 23:04
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.

2 participants