fix(ext/node): Implement detached option in child_process (#25218)

Fixes https://github.com/denoland/deno/issues/25193.
This commit is contained in:
Nathan Whitaker 2024-09-12 12:24:58 -07:00 committed by GitHub
parent 3f15e30062
commit 18b89d948d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 136 additions and 20 deletions

View file

@ -157,6 +157,10 @@ function run({
return new Process(res);
}
export const kExtraStdio = Symbol("extraStdio");
export const kIpc = Symbol("ipc");
export const kDetached = Symbol("detached");
const illegalConstructorKey = Symbol("illegalConstructorKey");
function spawnChildInner(command, apiName, {
@ -166,13 +170,14 @@ function spawnChildInner(command, apiName, {
env = { __proto__: null },
uid = undefined,
gid = undefined,
signal = undefined,
stdin = "null",
stdout = "piped",
stderr = "piped",
signal = undefined,
windowsRawArguments = false,
ipc = -1,
extraStdio = [],
[kDetached]: detached = false,
[kExtraStdio]: extraStdio = [],
[kIpc]: ipc = -1,
} = { __proto__: null }) {
const child = op_spawn_child({
cmd: pathFromURL(command),
@ -188,6 +193,7 @@ function spawnChildInner(command, apiName, {
windowsRawArguments,
ipc,
extraStdio,
detached,
}, apiName);
return new ChildProcess(illegalConstructorKey, {
...child,
@ -414,6 +420,7 @@ function spawnSync(command, {
stderr,
windowsRawArguments,
extraStdio: [],
detached: false,
});
return {
success: result.status.success,