diff options
author | 2023-08-30 00:16:08 -0700 | |
---|---|---|
committer | 2023-08-30 00:16:08 -0700 | |
commit | e3dc5b6b4ce2c10d1e9c61fec2e86409e4ce48b0 (patch) | |
tree | acf51076ff9001863beb91555a595917f0dbdf18 /src/js/node/child_process.js | |
parent | f2553d24543d72a777ba60213473332809866cb2 (diff) | |
download | bun-e3dc5b6b4ce2c10d1e9c61fec2e86409e4ce48b0.tar.gz bun-e3dc5b6b4ce2c10d1e9c61fec2e86409e4ce48b0.tar.zst bun-e3dc5b6b4ce2c10d1e9c61fec2e86409e4ce48b0.zip |
reset signal handlers in Bun.spawn (#4405)
* see if this fixes it
* We don't need this
* Remove extra flag
---------
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Diffstat (limited to 'src/js/node/child_process.js')
-rw-r--r-- | src/js/node/child_process.js | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/js/node/child_process.js b/src/js/node/child_process.js index ef96dbce5..6878f3ca1 100644 --- a/src/js/node/child_process.js +++ b/src/js/node/child_process.js @@ -888,9 +888,13 @@ function normalizeSpawnArguments(file, args, options) { cwd = getValidatedPath(cwd, "options.cwd"); } - // TODO: Detached check // TODO: Gid check // TODO: Uid check + var detached = false; + const { detached: detachedOption } = options; + if (detachedOption != null) { + detached = !!detachedOption; + } // Validate the shell, if present. if (options.shell != null && typeof options.shell !== "boolean" && typeof options.shell !== "string") { @@ -945,7 +949,7 @@ function normalizeSpawnArguments(file, args, options) { // TODO: Windows env support here... - return { ...options, file, args, cwd, envPairs }; + return { ...options, detached, file, args, cwd, envPairs }; } function checkExecSyncError(ret, args, cmd) { @@ -1155,7 +1159,7 @@ class ChildProcess extends EventEmitter { const bunStdio = getBunStdioFromOptions(stdio); var env = options.envPairs || undefined; - + const detachedOption = options.detached; this.#encoding = options.encoding || undefined; this.#stdioOptions = bunStdio; this.#handle = Bun.spawn({ @@ -1165,6 +1169,7 @@ class ChildProcess extends EventEmitter { stderr: bunStdio[2], cwd: options.cwd || undefined, env: env || process.env, + detached: typeof detachedOption !== "undefined" ? !!detachedOption : false, onExit: (handle, exitCode, signalCode, err) => { this.#handle = handle; this.pid = this.#handle.pid; |