@@ -282,9 +282,12 @@ static struct {
282
282
if (per_process::cli_options->trace_event_categories .empty ()) {
283
283
tracing_file_writer_ = tracing_agent_->DefaultHandle ();
284
284
} else {
285
+ std::vector<std::string> categories =
286
+ SplitString (per_process::cli_options->trace_event_categories , ' ,' );
287
+
285
288
tracing_file_writer_ = tracing_agent_->AddClient (
286
- ParseCommaSeparatedSet (
287
- per_process::cli_options-> trace_event_categories ),
289
+ std::set<std::string>( std::make_move_iterator (categories. begin ()),
290
+ std::make_move_iterator (categories. end ()) ),
288
291
std::unique_ptr<tracing::AsyncTraceWriter>(
289
292
new tracing::NodeTraceWriter (
290
293
per_process::cli_options->trace_event_file_pattern )),
@@ -1424,23 +1427,10 @@ void Init(std::vector<std::string>* argv,
1424
1427
#if !defined(NODE_WITHOUT_NODE_OPTIONS)
1425
1428
std::string node_options;
1426
1429
if (credentials::SafeGetenv (" NODE_OPTIONS" , &node_options)) {
1427
- std::vector<std::string> env_argv;
1428
- // [0] is expected to be the program name, fill it in from the real argv.
1429
- env_argv.push_back (argv->at (0 ));
1430
-
1431
- // Split NODE_OPTIONS at each ' ' character.
1432
- std::string::size_type index = std::string::npos;
1433
- do {
1434
- std::string::size_type prev_index = index ;
1435
- index = node_options.find (' ' , index + 1 );
1436
- if (index - prev_index == 1 ) continue ;
1437
-
1438
- const std::string option = node_options.substr (
1439
- prev_index + 1 , index - prev_index - 1 );
1440
- if (!option.empty ())
1441
- env_argv.emplace_back (std::move (option));
1442
- } while (index != std::string::npos);
1443
-
1430
+ // [0] is expected to be the program name, fill it in from the real argv
1431
+ // and use 'x' as a placeholder while parsing.
1432
+ std::vector<std::string> env_argv = SplitString (" x " + node_options, ' ' );
1433
+ env_argv[0 ] = argv->at (0 );
1444
1434
1445
1435
ProcessArgv (&env_argv, nullptr , true );
1446
1436
}
0 commit comments