Skip to content

fix: stop installation on download stream errors (#75) - #1352

Open
IkedaHarket wants to merge 1 commit into
coreybutler:masterfrom
IkedaHarket:fix/issue-75-download-failure
Open

fix: stop installation on download stream errors (#75)#1352
IkedaHarket wants to merge 1 commit into
coreybutler:masterfrom
IkedaHarket:fix/issue-75-download-failure

Conversation

@IkedaHarket

Copy link
Copy Markdown

This PR fixes issue #75 where nvm install would incorrectly report a "Complete" status even if the network connection was lost or interrupted during the download process.

Currently, if io.Copy fails due to a connection reset or other stream errors, the error is printed but the function continues to return true, leading the installer to proceed as if the download were successful. This change ensures that any error during the download stream correctly returns false, halting the installation and triggering the necessary rollback.

Changes

  • Modified src/web/web.go: Added return false within the io.Copy error handling block in the Download function.

Verification Results

Unit Tests

I created a mock server test that simulates an unexpected connection reset (unexpected EOF) mid-download.

PS C:\Users\sebaa\Desktop\GitHub\nvm-windows\src> go test -v ./web
=== RUN    TestDownloadFailure
Error while downloading [http://127.0.0.1:60493](http://127.0.0.1:60493): unexpected EOF
--- PASS: TestDownloadFailure (0.00s)
PASS
ok      nvm/web 0.652s

@github-actions

github-actions Bot commented Jun 7, 2026

Copy link
Copy Markdown

This PR is stale because it has been open 45 days with no activity.

@github-actions github-actions Bot added the Stale Stale label Jun 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Stale Stale

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant