From e8583be4e40b1e8b3332b85da89846757657c499 Mon Sep 17 00:00:00 2001 From: theanarkh Date: Sat, 12 Jul 2025 16:39:12 +0800 Subject: [PATCH] lib: add trace-sigint APIs --- doc/api/process.md | 8 ++++++ lib/internal/process/pre_execution.js | 21 ++++++++++++--- lib/internal/watchdog.js | 1 - test/parallel/test-start-trace-sigint.js | 32 +++++++++++++++++++++++ test/parallel/test-stop-trace-sigint.js | 33 ++++++++++++++++++++++++ 5 files changed, 90 insertions(+), 5 deletions(-) create mode 100644 test/parallel/test-start-trace-sigint.js create mode 100644 test/parallel/test-stop-trace-sigint.js diff --git a/doc/api/process.md b/doc/api/process.md index 9182d25219c92f..ab3e58679bf5e5 100644 --- a/doc/api/process.md +++ b/doc/api/process.md @@ -4059,6 +4059,10 @@ This property refers to the value of underlying file descriptor of `process.stderr`. The value is fixed at `2`. In [`Worker`][] threads, this field does not exist. +## `process.startTraceSigInt` + +Prints a stack trace on `SIGINT`. + ## `process.stdin` * {Stream} @@ -4168,6 +4172,10 @@ false See the [TTY][] documentation for more information. +## `process.stopTraceSigInt` + +Stop Printing a stack trace on `SIGINT`. + ## `process.throwDeprecation`