MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / ReadPipe

Function ReadPipe

Source/Engine/Platform/Windows/WindowsPlatform.cpp:1132–1165  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1130}
1131
1132void ReadPipe(HANDLE pipe, Array<char>& rawData, Array<Char>& logData, LogType logType, CreateProcessSettings& settings)
1133{
1134 // Check if any data is ready to read
1135 DWORD bytesAvailable = 0;
1136 if (PeekNamedPipe(pipe, nullptr, 0, nullptr, &bytesAvailable, nullptr) && bytesAvailable > 0)
1137 {
1138 // Read data
1139 rawData.Clear();
1140 rawData.Resize(bytesAvailable);
1141 DWORD bytesRead = 0;
1142 if (ReadFile(pipe, rawData.Get(), bytesAvailable, &bytesRead, nullptr) && bytesRead > 0)
1143 {
1144 // Skip Windows-style lines
1145 rawData.RemoveAllKeepOrder('\r');
1146
1147 // Remove last new line character
1148 if (rawData.Last() == '\n')
1149 rawData.RemoveLast();
1150
1151 // Log contents
1152 logData.Clear();
1153 logData.Resize(rawData.Count() + 1);
1154 int32 tmp;
1155 StringUtils::ConvertANSI2UTF16(rawData.Get(), logData.Get(), rawData.Count(), tmp);
1156 logData.Last() = '\0';
1157#if LOG_ENABLE
1158 if (settings.LogOutput)
1159 Log::Logger::Write(logType, StringView(logData.Get(), rawData.Count()));
1160#endif
1161 if (settings.SaveOutput)
1162 settings.Output.Add(logData.Get(), rawData.Count());
1163 }
1164 }
1165}
1166
1167int32 WindowsPlatform::CreateProcess(CreateProcessSettings& settings)
1168{

Callers 1

CreateProcessMethod · 0.85

Calls 11

ReadFileFunction · 0.85
RemoveAllKeepOrderMethod · 0.80
RemoveLastMethod · 0.80
WriteFunction · 0.50
StringViewClass · 0.50
ClearMethod · 0.45
ResizeMethod · 0.45
GetMethod · 0.45
LastMethod · 0.45
CountMethod · 0.45
AddMethod · 0.45

Tested by

no test coverage detected