Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ext/node): unref pending reads in readStop #27064

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions ext/io/12_io.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@ class Stdin {
if (this.#opPromise) {
core.unrefOpPromise(this.#opPromise);
}
// Reset the promise so that it can be re-ref'd.
this.#opPromise = undefined;
}
}

Expand Down
6 changes: 6 additions & 0 deletions ext/node/polyfills/internal_binding/stream_wrap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,12 @@ export class LibuvStreamWrap extends HandleWrap {
readStop(): number {
this.#reading = false;

// Unref any reads that are pending until this point.
if (this.unref) {
this.unref();
this.ref();
}
littledivy marked this conversation as resolved.
Show resolved Hide resolved

return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion tests/node_compat/runner/TODO.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!-- deno-fmt-ignore-file -->
# Remaining Node Tests

594 tests out of 3681 have been ported from Node 20.11.1 (16.14% ported, 83.97% remaining).
595 tests out of 3681 have been ported from Node 20.11.1 (16.16% ported, 83.94% remaining).

NOTE: This file should not be manually edited. Please edit `tests/node_compat/config.json` and run `deno task setup` in `tests/node_compat/runner` dir instead.

Expand Down
5 changes: 5 additions & 0 deletions tests/specs/node/stdin_pause/__test__.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"args": "run -A main.mjs",
"output": "",
"exitCode": 0
}
2 changes: 2 additions & 0 deletions tests/specs/node/stdin_pause/main.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
process.stdin.on("data", () => {});
process.stdin.pause();
Loading