From 50f076d7ce062de2c4db364b0a61d041ac4b22ab Mon Sep 17 00:00:00 2001 From: Moshe Atlow Date: Mon, 26 Jun 2023 01:03:28 +0300 Subject: [PATCH] child_process: support `Symbol.asyncDispose` --- doc/api/child_process.md | 11 ++++++++ lib/child_process.js | 21 +++------------ lib/internal/child_process.js | 30 ++++++++++++++++++++- test/parallel/test-child-process-destroy.js | 26 ++++++++++++++++++ 4 files changed, 70 insertions(+), 18 deletions(-) create mode 100644 test/parallel/test-child-process-destroy.js diff --git a/doc/api/child_process.md b/doc/api/child_process.md index 70345e9472c66e..32844e822d4f77 100644 --- a/doc/api/child_process.md +++ b/doc/api/child_process.md @@ -1402,6 +1402,17 @@ setTimeout(() => { }, 2000); ``` +### `subprocess[Symbol.asyncDispose]()` + + + +> Stability: 1 - Experimental + +Calls [`subprocess.kill()`][] with the `killSignal` option (the default is `'SIGTERM'`). +and returns a promise that fulfills when the process is closed. + ### `subprocess.killed`