Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2020-04-12 19:55:03 +0300
committerAnna Henningsen <anna@addaleax.net>2020-04-15 03:11:43 +0300
commite0a7fd7d214300496a3b63eec74296661d844a2d (patch)
treebdab5bf444437748cd7a5b1f2749a6becebcab36 /src/node_errors.cc
parent907ebdd76d45aa7f5dbd0972da79a959e6f34246 (diff)
src: use basename(argv0) for --trace-uncaught suggestion
Refs: https://github.com/nodejs/node/pull/32797#discussion_r407222290 PR-URL: https://github.com/nodejs/node/pull/32798 Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Diffstat (limited to 'src/node_errors.cc')
-rw-r--r--src/node_errors.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/node_errors.cc b/src/node_errors.cc
index 9bae27550ce..4e13c24e15e 100644
--- a/src/node_errors.cc
+++ b/src/node_errors.cc
@@ -375,8 +375,13 @@ static void ReportFatalException(Environment* env,
}
if (!env->options()->trace_uncaught) {
- FPrintF(stderr, "(Use `node --trace-uncaught ...` to show "
- "where the exception was thrown)\n");
+ std::string argv0;
+ if (!env->argv().empty()) argv0 = env->argv()[0];
+ if (argv0.empty()) argv0 = "node";
+ FPrintF(stderr,
+ "(Use `%s --trace-uncaught ...` to show where the exception "
+ "was thrown)\n",
+ fs::Basename(argv0, ".exe"));
}
}