Skip to content

Commit

Permalink
Document alternatives to process termination
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed Apr 28, 2024
1 parent 113a7fe commit 7b0641c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions docs/termination.md
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 7b0641c

Please sign in to comment.