Repository navigation
Cancel active ZIP entries when the archive is destroyed - #228
Open
Sinkleberg wants to merge 1 commit into
Open
Sinkleberg wants to merge 1 commit into
Sinkleberg wants to merge 1 commit into
Conversation
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.
Destroying a ZIP archive now cancels its active input and compression stream and settles the entry callback once. Cancellation stays active through header and data-descriptor writes, preserving supplied errors and preventing later entry writes. Pending callbacks receive
ERR_STREAM_DESTROYEDwhen destruction has no error.The library keeps its own source error handler until the input closes, so asynchronous cleanup failures cannot become unhandled errors after cancellation or successful completion. It preserves caller listeners and removes only its own handlers after close.
Fixes #143, covering the compress-commons part of archiverjs/node-zip-stream#166 and archiverjs/node-zip-stream#167.
Windows/Node 24.19.0: 25 cancellation checks fail against original production; the patched full Mocha suite passes 75 tests with 20 existing pending tests. Native subprocess probes cover failing cleanup with/without caller handlers, stored/deflated inputs and error/no-error cancellation. Complete-archive content and small ZIP64 descriptor controls pass, as does changed-file Prettier. The actual Mocha entry point was used because the Windows npm wrapper could not locate Mocha; Node 18/20 Linux CI and downstream integration were not run.