@@ -282,9 +282,12 @@ static struct {
282282 if (per_process::cli_options->trace_event_categories .empty ()) {
283283 tracing_file_writer_ = tracing_agent_->DefaultHandle ();
284284 } else {
285+ std::vector<std::string> categories =
286+ SplitString (per_process::cli_options->trace_event_categories , ' ,' );
287+
285288 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 ()) ),
288291 std::unique_ptr<tracing::AsyncTraceWriter>(
289292 new tracing::NodeTraceWriter (
290293 per_process::cli_options->trace_event_file_pattern )),
@@ -1420,23 +1423,10 @@ void Init(std::vector<std::string>* argv,
14201423#if !defined(NODE_WITHOUT_NODE_OPTIONS)
14211424 std::string node_options;
14221425 if (credentials::SafeGetenv (" NODE_OPTIONS" , &node_options)) {
1423- std::vector<std::string> env_argv;
1424- // [0] is expected to be the program name, fill it in from the real argv.
1425- env_argv.push_back (argv->at (0 ));
1426-
1427- // Split NODE_OPTIONS at each ' ' character.
1428- std::string::size_type index = std::string::npos;
1429- do {
1430- std::string::size_type prev_index = index;
1431- index = node_options.find (' ' , index + 1 );
1432- if (index - prev_index == 1 ) continue ;
1433-
1434- const std::string option = node_options.substr (
1435- prev_index + 1 , index - prev_index - 1 );
1436- if (!option.empty ())
1437- env_argv.emplace_back (std::move (option));
1438- } while (index != std::string::npos);
1439-
1426+ // [0] is expected to be the program name, fill it in from the real argv
1427+ // and use 'x' as a placeholder while parsing.
1428+ std::vector<std::string> env_argv = SplitString (" x " + node_options, ' ' );
1429+ env_argv[0 ] = argv->at (0 );
14401430
14411431 ProcessArgv (&env_argv, nullptr , true );
14421432 }
0 commit comments