| 220 | } |
| 221 | |
| 222 | void 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 | |
| 262 | void cmProcess::OnAllocateCB(uv_handle_t* handle, size_t suggested_size, |
| 263 | uv_buf_t* buf) |
no test coverage detected