Conversation
Fix several issues with `Utf8Stream` flushing: * `flush()` now writes buffered data regardless of `minLength` and invokes the callback only after pending writes complete, including when `minLength` is zero and a write is in flight. * Multiple concurrent `flush()` calls are tracked correctly and `end()` waits for pending flushes before closing. * `flushSync()` throws `ERR_INVALID_STATE` if called while an asynchronous write is in progress instead of corrupting output. * Periodic flushes no longer stack up while a flush is pending. * `fsync` is skipped for stdout/stderr file descriptors. * `reopen()`, `end()` and `destroy()` behave correctly when the stream is destroyed while still opening. Signed-off-by: James M Snell <jasnell@gmail.com> Assisted-by: Opencode
Collaborator
|
Review requested:
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #66473 +/- ##
=======================================
Coverage 90.42% 90.42%
=======================================
Files 791 791
Lines 275569 275662 +93
Branches 52842 52888 +46
=======================================
+ Hits 249185 249273 +88
+ Misses 16802 16800 -2
- Partials 9582 9589 +7
🚀 New features to boost your workflow:
|
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.
Fix several issues with
Utf8Streamflushing:flush()now writes buffered data regardless ofminLengthand invokes the callback only after pending writes complete, including whenminLengthis zero and a write is in flight.flush()calls are tracked correctly andend()waits for pending flushes before closing.flushSync()throwsERR_INVALID_STATEif called while an asynchronous write is in progress instead of corrupting output.fsyncis skipped for stdout/stderr file descriptors.reopen(),end()anddestroy()behave correctly when the stream is destroyed while still opening.Separated out from #65840