Skip to content

Commit

Permalink
Document alternatives to process termination (#1026)
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky authored May 5, 2024
1 parent e5df163 commit 9d7eed8
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions docs/termination.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@

# 🏁 Termination

## Alternatives

Terminating a subprocess ends it abruptly. This prevents rolling back the subprocess' operations and leaves them incomplete. When possible, graceful exits should be preferred, such as:
- Letting the subprocess end on its own.
- [Performing cleanup](#sigterm) in termination [signal handlers](https://nodejs.org/api/process.html#process_signal_events).
- [Sending a message](ipc.md) to the subprocess so it aborts its operations and cleans up.

## Canceling

The [`cancelSignal`](api.md#optionscancelsignal) option can be used to cancel a subprocess. When [`abortController`](https://developer.mozilla.org/en-US/docs/Web/API/AbortController) is [aborted](https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort), a [`SIGTERM` signal](#default-signal) is sent to the subprocess.
Expand Down

0 comments on commit 9d7eed8

Please sign in to comment.