Repository navigation
Commit e6662cb
stream: fix Utf8Stream flush handling
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 <[email protected]>
Assisted-by: Opencode
PR-URL: #66473
Reviewed-By: Matteo Collina <[email protected]>1 parent 1aa10d8 commit e6662cb
6 files changed
Lines changed: 702 additions & 78 deletions
File tree
- doc/api
- lib/internal/streams
- test/parallel
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8508 | 8508 | | |
8509 | 8509 | | |
8510 | 8510 | | |
8511 | | - | |
8512 | | - | |
| 8511 | + | |
| 8512 | + | |
| 8513 | + | |
| 8514 | + | |
| 8515 | + | |
8513 | 8516 | | |
8514 | 8517 | | |
8515 | 8518 | | |
8516 | 8519 | | |
8517 | 8520 | | |
| 8521 | + | |
| 8522 | + | |
| 8523 | + | |
| 8524 | + | |
8518 | 8525 | | |
8519 | 8526 | | |
8520 | 8527 | | |
| |||
0 commit comments