summaryrefslogtreecommitdiff
path: root/ext/node/polyfills/internal_binding
diff options
context:
space:
mode:
authorNathan Whitaker <17734409+nathanwhit@users.noreply.github.com>2024-08-15 09:38:46 -0700
committerGitHub <noreply@github.com>2024-08-15 09:38:46 -0700
commit8749d651fb5e0964cdb8e62be7a59a603cbc3c7c (patch)
tree1506d08504561a4013ad03ff1068bec23e572102 /ext/node/polyfills/internal_binding
parent7ca95fc999f22cb0eb312e02f8c40d7589b35b7e (diff)
fix(node): Create additional pipes for child processes (#25016)
Linux/macos only currently. Part of https://github.com/denoland/deno/issues/23524 (fixes it on platforms other than windows). Part of #16899 (fixes it on platforms other than windows). After this PR, playwright is functional on mac/linux.
Diffstat (limited to 'ext/node/polyfills/internal_binding')
-rw-r--r--ext/node/polyfills/internal_binding/pipe_wrap.ts11
-rw-r--r--ext/node/polyfills/internal_binding/stream_wrap.ts11
2 files changed, 15 insertions, 7 deletions
diff --git a/ext/node/polyfills/internal_binding/pipe_wrap.ts b/ext/node/polyfills/internal_binding/pipe_wrap.ts
index a657f7018..f5c3c5439 100644
--- a/ext/node/polyfills/internal_binding/pipe_wrap.ts
+++ b/ext/node/polyfills/internal_binding/pipe_wrap.ts
@@ -37,7 +37,10 @@ import {
import { LibuvStreamWrap } from "ext:deno_node/internal_binding/stream_wrap.ts";
import { codeMap } from "ext:deno_node/internal_binding/uv.ts";
import { delay } from "ext:deno_node/_util/async.ts";
-import { kStreamBaseField } from "ext:deno_node/internal_binding/stream_wrap.ts";
+import {
+ kStreamBaseField,
+ StreamBase,
+} from "ext:deno_node/internal_binding/stream_wrap.ts";
import {
ceilPowOf2,
INITIAL_ACCEPT_BACKOFF_DELAY,
@@ -68,7 +71,7 @@ export class Pipe extends ConnectionWrap {
#closed = false;
#acceptBackoffDelay?: number;
- constructor(type: number, conn?: Deno.UnixConn) {
+ constructor(type: number, conn?: Deno.UnixConn | StreamBase) {
let provider: providerType;
let ipc: boolean;
@@ -100,8 +103,8 @@ export class Pipe extends ConnectionWrap {
this.ipc = ipc;
- if (conn && provider === providerType.PIPEWRAP) {
- const localAddr = conn.localAddr as Deno.UnixAddr;
+ if (conn && provider === providerType.PIPEWRAP && "localAddr" in conn) {
+ const localAddr = conn.localAddr;
this.#address = localAddr.path;
}
}
diff --git a/ext/node/polyfills/internal_binding/stream_wrap.ts b/ext/node/polyfills/internal_binding/stream_wrap.ts
index 4915a38ca..dc30bfdfe 100644
--- a/ext/node/polyfills/internal_binding/stream_wrap.ts
+++ b/ext/node/polyfills/internal_binding/stream_wrap.ts
@@ -44,11 +44,11 @@ import {
} from "ext:deno_node/internal_binding/async_wrap.ts";
import { codeMap } from "ext:deno_node/internal_binding/uv.ts";
-interface Reader {
+export interface Reader {
read(p: Uint8Array): Promise<number | null>;
}
-interface Writer {
+export interface Writer {
write(p: Uint8Array): Promise<number>;
}
@@ -56,7 +56,12 @@ export interface Closer {
close(): void;
}
-type Ref = { ref(): void; unref(): void };
+export interface Ref {
+ ref(): void;
+ unref(): void;
+}
+
+export interface StreamBase extends Reader, Writer, Closer, Ref {}
const enum StreamBaseStateFields {
kReadBytesOrError,