node/test/fixtures/deep-exit.js
Joyee Cheung 65fbc95949 src: parse --stack-trace-limit and use it in --trace-* flags
Previously, --trace-exit and --trace-sync-io doesn't take care
of --stack-trace-limit and always print a stack trace with maximum
size of 10. This patch parses --stack-trace-limit during
initialization and use the value in --trace-* flags.

PR-URL: https://github.com/nodejs/node/pull/55121
Fixes: https://github.com/nodejs/node/issues/55100
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
2024-09-30 15:05:12 +00:00

16 lines
247 B
JavaScript

'use strict';
// This is meant to be run with --trace-exit.
const depth = parseInt(process.env.STACK_DEPTH) || 30;
let counter = 1;
function recurse() {
if (counter++ < depth) {
recurse();
} else {
process.exit(0);
}
}
recurse();