MCPcopy Create free account
hub / github.com/AGWA/git-crypt / read_stdout

Method read_stdout

coprocess-win32.cpp:252–269  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

250}
251
252size_t Coprocess::read_stdout (void* handle, void* buf, size_t count)
253{
254 // Note that ReadFile on a pipe may return with bytes_read==0 if the other
255 // end of the pipe writes zero bytes, so retry when this happens.
256 // When the other end of the pipe actually closes, ReadFile
257 // fails with ERROR_BROKEN_PIPE.
258 DWORD bytes_read;
259 do {
260 if (!ReadFile(static_cast<Coprocess*>(handle)->stdout_pipe_reader, buf, count, &bytes_read, nullptr)) {
261 const DWORD read_error = GetLastError();
262 if (read_error != ERROR_BROKEN_PIPE) {
263 throw System_error("ReadFile", "", read_error);
264 }
265 return 0;
266 }
267 } while (bytes_read == 0);
268 return bytes_read;
269}

Callers

nothing calls this directly

Calls 1

System_errorClass · 0.85

Tested by

no test coverage detected