summaryrefslogtreecommitdiff
path: root/runtime/js
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 /runtime/js
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 'runtime/js')
-rw-r--r--runtime/js/40_process.js24
1 files changed, 15 insertions, 9 deletions
diff --git a/runtime/js/40_process.js b/runtime/js/40_process.js
index 6db04468f..0f28b9d5c 100644
--- a/runtime/js/40_process.js
+++ b/runtime/js/40_process.js
@@ -168,7 +168,7 @@ function run({
const illegalConstructorKey = Symbol("illegalConstructorKey");
-function spawnChildInner(opFn, command, apiName, {
+function spawnChildInner(command, apiName, {
args = [],
cwd = undefined,
clearEnv = false,
@@ -181,8 +181,9 @@ function spawnChildInner(opFn, command, apiName, {
signal = undefined,
windowsRawArguments = false,
ipc = -1,
+ extraStdio = [],
} = { __proto__: null }) {
- const child = opFn({
+ const child = op_spawn_child({
cmd: pathFromURL(command),
args: ArrayPrototypeMap(args, String),
cwd: pathFromURL(cwd),
@@ -195,6 +196,7 @@ function spawnChildInner(opFn, command, apiName, {
stderr,
windowsRawArguments,
ipc,
+ extraStdio,
}, apiName);
return new ChildProcess(illegalConstructorKey, {
...child,
@@ -204,7 +206,6 @@ function spawnChildInner(opFn, command, apiName, {
function spawnChild(command, options = { __proto__: null }) {
return spawnChildInner(
- op_spawn_child,
command,
"Deno.Command().spawn()",
options,
@@ -221,16 +222,19 @@ function collectOutput(readableStream) {
return readableStreamCollectIntoUint8Array(readableStream);
}
-const _pipeFd = Symbol("[[pipeFd]]");
+const _ipcPipeRid = Symbol("[[ipcPipeRid]]");
+const _extraPipeRids = Symbol("[[_extraPipeRids]]");
-internals.getPipeFd = (process) => process[_pipeFd];
+internals.getIpcPipeRid = (process) => process[_ipcPipeRid];
+internals.getExtraPipeRids = (process) => process[_extraPipeRids];
class ChildProcess {
#rid;
#waitPromise;
#waitComplete = false;
- [_pipeFd];
+ [_ipcPipeRid];
+ [_extraPipeRids];
#pid;
get pid() {
@@ -268,7 +272,8 @@ class ChildProcess {
stdinRid,
stdoutRid,
stderrRid,
- pipeFd, // internal
+ ipcPipeRid, // internal
+ extraPipeRids,
} = null) {
if (key !== illegalConstructorKey) {
throw new TypeError("Illegal constructor.");
@@ -276,7 +281,8 @@ class ChildProcess {
this.#rid = rid;
this.#pid = pid;
- this[_pipeFd] = pipeFd;
+ this[_ipcPipeRid] = ipcPipeRid;
+ this[_extraPipeRids] = extraPipeRids;
if (stdinRid !== null) {
this.#stdin = writableStreamForRid(stdinRid);
@@ -380,7 +386,6 @@ function spawn(command, options) {
);
}
return spawnChildInner(
- op_spawn_child,
command,
"Deno.Command().output()",
options,
@@ -417,6 +422,7 @@ function spawnSync(command, {
stdout,
stderr,
windowsRawArguments,
+ extraStdio: [],
});
return {
success: result.status.success,