@@ -1013,20 +1013,29 @@ static Status LaunchProcessXPC(const char *exe_path,
10131013 xpc_dictionary_set_int64 (message, LauncherXPCServicePosixspawnFlagsKey,
10141014 GetPosixspawnFlags (launch_info));
10151015 const FileAction *file_action = launch_info.GetFileActionForFD (STDIN_FILENO);
1016- if (file_action && !file_action->GetPath ().empty ()) {
1016+ std::string file_action_path;
1017+ if (file_action)
1018+ file_action_path = file_action->GetFileSpec ().GetPath ();
1019+
1020+ if (!file_action_path.empty ())
10171021 xpc_dictionary_set_string (message, LauncherXPCServiceStdInPathKeyKey,
1018- file_action-> GetPath (). str () .c_str ());
1019- }
1022+ file_action_path .c_str ());
1023+
10201024 file_action = launch_info.GetFileActionForFD (STDOUT_FILENO);
1021- if (file_action && !file_action->GetPath ().empty ()) {
1025+ if (file_action)
1026+ file_action_path = file_action->GetFileSpec ().GetPath ();
1027+
1028+ if (!file_action_path.empty ())
10221029 xpc_dictionary_set_string (message, LauncherXPCServiceStdOutPathKeyKey,
1023- file_action-> GetPath (). str () .c_str ());
1024- }
1030+ file_action_path .c_str ());
1031+
10251032 file_action = launch_info.GetFileActionForFD (STDERR_FILENO);
1026- if (file_action && !file_action->GetPath ().empty ()) {
1033+ if (file_action)
1034+ file_action_path = file_action->GetFileSpec ().GetPath ();
1035+
1036+ if (!file_action_path.empty ())
10271037 xpc_dictionary_set_string (message, LauncherXPCServiceStdErrPathKeyKey,
1028- file_action->GetPath ().str ().c_str ());
1029- }
1038+ file_action_path.c_str ());
10301039
10311040 xpc_object_t reply =
10321041 xpc_connection_send_message_with_reply_sync (conn, message);
@@ -1135,16 +1144,16 @@ static bool AddPosixSpawnFileAction(void *_file_actions, const FileAction *info,
11351144 if (oflag & O_CREAT)
11361145 mode = 0640 ;
11371146
1138- error = Status (::posix_spawn_file_actions_addopen (
1139- file_actions, info->GetFD (),
1140- info->GetPath ().str ().c_str (), oflag, mode),
1141- eErrorTypePOSIX);
1147+ const std::string file_path (info->GetFileSpec ().GetPath ());
1148+ error = Status (
1149+ ::posix_spawn_file_actions_addopen (file_actions, info->GetFD (),
1150+ file_path.c_str(), oflag, mode),
1151+ eErrorTypePOSIX);
11421152 if (error.Fail())
11431153 LLDB_LOG(log,
11441154 " error: {0}, posix_spawn_file_actions_addopen (action={1}, "
11451155 " fd={2}, path='{3}', oflag={4}, mode={5})" ,
1146- error, file_actions, info->GetFD (), info->GetPath (), oflag,
1147- mode);
1156+ error, file_actions, info->GetFD (), file_path, oflag, mode);
11481157 }
11491158 break ;
11501159 }
0 commit comments