From 7bc6eb41018e0a8553add519559055c7e7b6f322 Mon Sep 17 00:00:00 2001 From: Mikael Finstad Date: Tue, 11 Jul 2023 18:23:40 +0200 Subject: [PATCH] Add note about graceful termination (#562) --- index.d.ts | 2 +- readme.md | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/index.d.ts b/index.d.ts index 576e7cffb9..bbf581a914 100644 --- a/index.d.ts +++ b/index.d.ts @@ -460,7 +460,7 @@ export type ExecaChildPromise = { ): Promise | ResultType>; /** - Same as the original [`child_process#kill()`](https://nodejs.org/api/child_process.html#child_process_subprocess_kill_signal), except if `signal` is `SIGTERM` (the default value) and the child process is not terminated after 5 seconds, force it by sending `SIGKILL`. + Same as the original [`child_process#kill()`](https://nodejs.org/api/child_process.html#child_process_subprocess_kill_signal), except if `signal` is `SIGTERM` (the default value) and the child process is not terminated after 5 seconds, force it by sending `SIGKILL`. Note that this graceful termination does not work on Windows, because Windows [doesn't support signals](https://nodejs.org/api/process.html#process_signal_events) (`SIGKILL` and `SIGTERM` has the same effect of force-killing the process immediately.) If you want to achieve graceful termination on Windows, you have to use other means, such as [`taskkill`](https://github.com/sindresorhus/taskkill). */ kill(signal?: string, options?: KillOptions): void; diff --git a/readme.md b/readme.md index 6b1f43eb7d..553c368c9f 100644 --- a/readme.md +++ b/readme.md @@ -287,6 +287,8 @@ The return value of all [asynchronous methods](#methods) is both: Same as the original [`child_process#kill()`](https://nodejs.org/api/child_process.html#child_process_subprocess_kill_signal) except: if `signal` is `SIGTERM` (the default value) and the child process is not terminated after 5 seconds, force it by sending `SIGKILL`. +Note that this graceful termination does not work on Windows, because Windows [doesn't support signals](https://nodejs.org/api/process.html#process_signal_events) (`SIGKILL` and `SIGTERM` has the same effect of force-killing the process immediately.) If you want to achieve graceful termination on Windows, you have to use other means, such as [`taskkill`](https://github.com/sindresorhus/taskkill). + ##### options.forceKillAfterTimeout Type: `number | false`\