Skip to content

child_process: fix spawn and fork AbortSignal behavior

This PR fixes a few errors with AbortSignal and spawn/fork.

I've changed the AbortSignal to get removed on 'exit', instead of 'close' which I think is more correct. This fixed a bug in fork (see added test in the fork tests) where an AbortError could be emitted even though the process was already exited.

In spawn, the 'abort' event didn't kill the process (see #37273 (closed)), which is now fixed. For both spawn and fork, I've also changed it to emit AbortError only when kill returns true.

I've also added killSignal to the documentation, as it was already used by the AbortSignal code, but was undocumented. So I've added sanitize as well (and tests for the killSignal).

Fixes #37273 (closed) .

Merge request reports

Loading