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: race condition between WriteStream close and process exit #281

Merged
merged 4 commits into from
May 15, 2024

Conversation

andrewjanssen
Copy link

@andrewjanssen andrewjanssen commented May 3, 2024

The process may exit before the WriteStream finishes writing to the target file. For example, I have a small release file for which only the first of two stream chunks is downloaded because the process terminates first, resulting in a corrupted file.

Thank you for this useful package!

Copy link

codecov bot commented May 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.60%. Comparing base (b10e911) to head (0a87690).
Report is 9 commits behind head on master.

❗ Current head 0a87690 differs from pull request most recent head 586040b. Consider uploading reports for the commit 586040b to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #281      +/-   ##
==========================================
+ Coverage   74.19%   74.60%   +0.40%     
==========================================
  Files           7        7              
  Lines         124      126       +2     
  Branches       28       29       +1     
==========================================
+ Hits           92       94       +2     
  Misses         32       32              
Files Coverage Δ
src/download.ts 96.87% <100.00%> (+0.20%) ⬆️

@andrewjanssen
Copy link
Author

andrewjanssen commented May 3, 2024

The Travis build is failing on node v12, I wonder if it's due to these close changes in Node 14. Assuming that's the problem— since node 12 is EOL, let me know if you would like me to request the close event to support node 12, or not.

@godber
Copy link
Member

godber commented May 3, 2024

Yeah, we should abandon the old node versions, and I've just noticed this is still on TravisCI ... thanks for the PR, we'll get back to you on this one.

@andrewjanssen andrewjanssen mentioned this pull request May 3, 2024
@godber godber requested a review from busma13 May 8, 2024 20:42
Copy link

@busma13 busma13 left a comment

Choose a reason for hiding this comment

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

This looks good. Thanks @andrewjanssen
We'll need to merge #284 first

@godber
Copy link
Member

godber commented May 14, 2024

@andrewjanssen we've reworked our CI to run in Github and done some package updates, can you update your branch and bump the version in package.json to 0.8.10?

@andrewjanssen
Copy link
Author

can you update your branch and bump the version in package.json to 0.8.10?

Done!

@godber
Copy link
Member

godber commented May 15, 2024

Looks great! Tests pass, thanks for the contribution @andrewjanssen !

@godber godber merged commit ce857db into terascope:master May 15, 2024
4 checks passed
@godber
Copy link
Member

godber commented May 15, 2024

fixes: #283

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.

3 participants