Skip to content

Commit

Permalink
Fix race condition with accessing stdioOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
anaisbetts committed Jan 23, 2025
1 parent 7830e15 commit b745c4a
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/js/node/child_process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1275,12 +1275,16 @@ class ChildProcess extends EventEmitter {
env: env,
detached: typeof detachedOption !== "undefined" ? !!detachedOption : false,
onExit: (handle, exitCode, signalCode, err) => {
if (hasSocketsToEagerlyLoad) {
this.stdio;
}
$debug("ChildProcess: onExit", exitCode, signalCode, err, this.pid);
this.#handle = handle;
this.pid = this.#handle.pid;
$debug("ChildProcess: onExit", exitCode, signalCode, err, this.pid);

if (hasSocketsToEagerlyLoad) {
process.nextTick(() => {
this.stdio;
$debug("ChildProcess: onExit", exitCode, signalCode, err, this.pid);
});
}

process.nextTick(
(exitCode, signalCode, err) => this.#handleOnExit(exitCode, signalCode, err),
Expand Down

0 comments on commit b745c4a

Please sign in to comment.