fix(npm): release HTTPS response stream in postinstall downloadFile (gh#3595)#3618
Open
steveyegge wants to merge 1 commit intomainfrom
Open
fix(npm): release HTTPS response stream in postinstall downloadFile (gh#3595)#3618steveyegge wants to merge 1 commit intomainfrom
steveyegge wants to merge 1 commit intomainfrom
Conversation
…gh#3595) On Windows, `npm install -g @gastown/gt` fails during the postinstall ZIP extraction with "The process cannot access the file ... because it is being used by another process." PowerShell's Expand-Archive cannot open the ZIP because Node.js still holds a handle to it. Root cause: downloadFile() pipes the HTTPS response into a write stream and resolves after file.close(), but never destroys the response. The readable stream keeps the file handle alive until GC, and Windows mandatory file locking prevents any other process from opening it in the meantime. Unix uses advisory locking, so macOS/Linux are unaffected. Fix: call response.destroy() immediately before resolving on the success path. The redirect path already cleans up (resume + file.close + recurse) and is unchanged. Closes gh#3595 Refs: hq-j6hur.6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes the HTTPS response stream in
postinstall.jsdownloadFile()before rename, fixing the file-handle leak that prevented zip extraction on Windows.Scope
Partial fix for hq-j6hur.6 (install/build breakage). Covers:
Context
Dispatched by mayor as part of release-gate hq-j6hur. Polecat: gastown/slit.
Opened by mayor because polecat pushed branch but did not open the PR (matches gh#3603, tracked in hq-j6hur.3).
Fixes #3595