@@ -277,6 +277,8 @@ std::string config_warning_file; // NOLINT(runtime/string) |
277 | 277 | // that is used by lib/internal/bootstrap/node.js |
278 | 278 | bool config_expose_internals = false; |
279 | 279 |
|
| 280 | +std::string config_process_title; // NOLINT(runtime/string) |
| 281 | + |
280 | 282 | bool v8_initialized = false; |
281 | 283 |
|
282 | 284 | bool linux_at_secure = false; |
@@ -3066,6 +3068,7 @@ static void PrintHelp() { |
3066 | 3068 | " write warnings to file instead of\n" |
3067 | 3069 | " stderr\n" |
3068 | 3070 | " --throw-deprecation throw an exception on deprecations\n" |
| 3071 | + " --title=title the process title to use on start up\n" |
3069 | 3072 | #if HAVE_OPENSSL |
3070 | 3073 | " --tls-cipher-list=val use an alternative default TLS cipher " |
3071 | 3074 | "list\n" |
@@ -3204,6 +3207,7 @@ static void CheckIfAllowedInEnv(const char* exe, bool is_env, |
3204 | 3207 | "--redirect-warnings", |
3205 | 3208 | "--require", |
3206 | 3209 | "--throw-deprecation", |
| 3210 | + "--title", |
3207 | 3211 | "--tls-cipher-list", |
3208 | 3212 | "--trace-deprecation", |
3209 | 3213 | "--trace-event-categories", |
@@ -3374,6 +3378,8 @@ static void ParseArgs(int* argc, |
3374 | 3378 | } else if (strncmp(arg, "--security-revert=", 18) == 0) { |
3375 | 3379 | const char* cve = arg + 18; |
3376 | 3380 | Revert(cve); |
| 3381 | + } else if (strncmp(arg, "--title=", 8) == 0) { |
| 3382 | + config_process_title = arg + 8; |
3377 | 3383 | } else if (strcmp(arg, "--preserve-symlinks") == 0) { |
3378 | 3384 | config_preserve_symlinks = true; |
3379 | 3385 | } else if (strcmp(arg, "--preserve-symlinks-main") == 0) { |
@@ -3868,6 +3874,10 @@ void Init(int* argc, |
3868 | 3874 |
|
3869 | 3875 | ProcessArgv(argc, argv, exec_argc, exec_argv); |
3870 | 3876 |
|
| 3877 | + // Set the process.title immediately after processing argv if --title is set. |
| 3878 | + if (!config_process_title.empty()) |
| 3879 | + uv_set_process_title(config_process_title.c_str()); |
| 3880 | + |
3871 | 3881 | #if defined(NODE_HAVE_I18N_SUPPORT) |
3872 | 3882 | // If the parameter isn't given, use the env variable. |
3873 | 3883 | if (icu_data_dir.empty()) |
|