From b57933f888e7c6be20154a5313d44a1f4df3a838 Mon Sep 17 00:00:00 2001 From: Mikael Finstad Date: Tue, 11 Jul 2023 12:14:36 +0200 Subject: [PATCH 1/2] Add note about graceful termination doesn't work on Windows --- readme.md | 2 ++ 1 file changed, 2 insertions(+) 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`\ From 106ae64cde7b1617a4e3fac2c8080d2cc330fa7e Mon Sep 17 00:00:00 2001 From: Mikael Finstad Date: Tue, 11 Jul 2023 16:50:00 +0200 Subject: [PATCH 2/2] Update index.d.ts --- index.d.ts | 2 +- 1 file changed, 1 insertion(+), 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;