summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJames M Snell <jasnell@gmail.com>2018-06-22 16:16:03 -0700
committerJames M Snell <jasnell@gmail.com>2018-07-10 16:16:37 -0700
commit9d71619bbee7c198cb20ec4702024ac983b5db7d (patch)
treef2dc49c316bfcfaa05a3ea5e4a419f518acd77a8 /src
parent67053568eee71a887578029ee715e3cef595c429 (diff)
downloadandroid-node-v8-9d71619bbee7c198cb20ec4702024ac983b5db7d.tar.gz
android-node-v8-9d71619bbee7c198cb20ec4702024ac983b5db7d.tar.bz2
android-node-v8-9d71619bbee7c198cb20ec4702024ac983b5db7d.zip
src: add --title command line argument
Simple utility command line argument for setting the process title on process startup. PR-URL: https://github.com/nodejs/node/pull/21477 Reviewed-By: Bradley Farias <bradley.meck@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
Diffstat (limited to 'src')
-rw-r--r--src/node.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/node.cc b/src/node.cc
index 4fb793705b..f9ac48c077 100644
--- a/src/node.cc
+++ b/src/node.cc
@@ -275,6 +275,8 @@ std::string config_warning_file; // NOLINT(runtime/string)
// that is used by lib/internal/bootstrap/node.js
bool config_expose_internals = false;
+std::string config_process_title; // NOLINT(runtime/string)
+
bool v8_initialized = false;
bool linux_at_secure = false;
@@ -2521,6 +2523,7 @@ static void PrintHelp() {
" write warnings to file instead of\n"
" stderr\n"
" --throw-deprecation throw an exception on deprecations\n"
+ " --title=title the process title to use on start up\n"
#if HAVE_OPENSSL
" --tls-cipher-list=val use an alternative default TLS cipher "
"list\n"
@@ -2658,6 +2661,7 @@ static void CheckIfAllowedInEnv(const char* exe, bool is_env,
"--redirect-warnings",
"--require",
"--throw-deprecation",
+ "--title",
"--tls-cipher-list",
"--trace-deprecation",
"--trace-event-categories",
@@ -2828,6 +2832,8 @@ static void ParseArgs(int* argc,
} else if (strncmp(arg, "--security-revert=", 18) == 0) {
const char* cve = arg + 18;
Revert(cve);
+ } else if (strncmp(arg, "--title=", 8) == 0) {
+ config_process_title = arg + 8;
} else if (strcmp(arg, "--preserve-symlinks") == 0) {
config_preserve_symlinks = true;
} else if (strcmp(arg, "--preserve-symlinks-main") == 0) {
@@ -3319,6 +3325,10 @@ void Init(int* argc,
ProcessArgv(argc, argv, exec_argc, exec_argv);
+ // Set the process.title immediately after processing argv if --title is set.
+ if (!config_process_title.empty())
+ uv_set_process_title(config_process_title.c_str());
+
#if defined(NODE_HAVE_I18N_SUPPORT)
// If the parameter isn't given, use the env variable.
if (icu_data_dir.empty())