fix(ext/node): support input option in spawnSync (#28792)

This commit is contained in:
Yoshiya Hinosawa 2025-04-09 13:42:12 +09:00 committed by GitHub
parent 9bc9faff49
commit cb00561e97
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 99 additions and 3 deletions

View file

@ -41,6 +41,9 @@ import {
writableStreamForRid,
} from "ext:deno_web/06_streams.js";
// The key for private `input` option for `Deno.Command`
const kInputOption = Symbol("kInputOption");
function opKill(pid, signo, apiName) {
op_kill(pid, signo, apiName);
}
@ -404,6 +407,7 @@ function spawnSync(command, {
stdout = "piped",
stderr = "piped",
windowsRawArguments = false,
[kInputOption]: input,
} = { __proto__: null }) {
if (stdin === "piped") {
throw new TypeError(
@ -425,6 +429,7 @@ function spawnSync(command, {
extraStdio: [],
detached: false,
needsNpmProcessState: false,
input,
});
return {
success: result.status.success,
@ -484,4 +489,4 @@ class Command {
}
}
export { ChildProcess, Command, kill, Process, run };
export { ChildProcess, Command, kill, kInputOption, Process, run };