MCPcopy Create free account
hub / github.com/Kitware/CMake / OnRead

Method OnRead

Source/CTest/cmProcess.cxx:222–260  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

220}
221
222void cmProcess::OnRead(ssize_t nread, uv_buf_t const* buf)
223{
224 std::string line;
225 if (nread > 0) {
226 std::string strdata;
227 this->Conv.DecodeText(buf->base, static_cast<size_t>(nread), strdata);
228 cm::append(this->Output, strdata);
229
230 while (this->Output.GetLine(line)) {
231 this->Runner->CheckOutput(line);
232 line.clear();
233 }
234
235 return;
236 }
237
238 if (nread == 0) {
239 return;
240 }
241
242 // The process will provide no more data.
243 if (nread != UV_EOF) {
244 auto error = static_cast<int>(nread);
245 cmCTestLog(this->Runner->GetCTest(), ERROR_MESSAGE,
246 "Error reading stream: " << uv_strerror(error) << std::endl);
247 }
248
249 // Look for partial last lines.
250 if (this->Output.GetLast(line)) {
251 this->Runner->CheckOutput(line);
252 }
253
254 this->ReadHandleClosed = true;
255 this->PipeReader.reset();
256 if (this->ProcessHandleClosed) {
257 uv_timer_stop(this->Timer);
258 this->Finish();
259 }
260}
261
262void cmProcess::OnAllocateCB(uv_handle_t* handle, size_t suggested_size,
263 uv_buf_t* buf)

Callers 2

OnReadCBMethod · 0.95
cmUVStreamReadFunction · 0.45

Calls 11

FinishMethod · 0.95
appendFunction · 0.85
uv_strerrorFunction · 0.85
uv_timer_stopFunction · 0.85
DecodeTextMethod · 0.80
CheckOutputMethod · 0.80
GetCTestMethod · 0.80
GetLastMethod · 0.80
GetLineMethod · 0.45
clearMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected