From 42266daa685442ea72e04e6f14e759281889436c Mon Sep 17 00:00:00 2001 From: legendecas Date: Sun, 17 Nov 2019 20:02:01 +0800 Subject: [PATCH 1/3] cli: add --trace-exit cli option It could be convenient to trace abnormal exit of the Node.js processes that printing stacktrace on each `process.exit` call with a cli option. This also takes effects on worker threads. --- doc/api/cli.md | 9 +++++ src/env.cc | 15 ++++++++ src/node_options.cc | 4 +++ src/node_options.h | 1 + test/parallel/test-trace-exit.js | 59 ++++++++++++++++++++++++++++++++ 5 files changed, 88 insertions(+) create mode 100644 test/parallel/test-trace-exit.js diff --git a/doc/api/cli.md b/doc/api/cli.md index d4b4da5249a16b..c4b17570cfe8f3 100644 --- a/doc/api/cli.md +++ b/doc/api/cli.md @@ -774,6 +774,14 @@ added: v7.7.0 Enables the collection of trace event tracing information. +### `--trace-exit` + + +Prints a stack trace whenever an environment is been exited proactively, i.e. +invoking `process.exit()`. + ### `--trace-sync-io` -Prints a stack trace whenever an environment is been exited proactively, i.e. -invoking `process.exit()`. +Prints a stack trace whenever an environment is exited proactively, +i.e. invoking `process.exit()`. ### `--trace-sync-io`