// поток чтения пайпа DWORD Updater::read_update_progress_thread(LPVOID param) { Updater* updater = static_cast<Updater*>(param); updater->AddProgressInfo(prog_info::PROGRESS_START); for (;;) { std::string output; const int BUFSIZE = 1024; char chBuf[BUFSIZE]; DWORD dwRead; DWORD ec = 0; //exit code DWORD bytesAvailable = 0; while (PeekNamedPipe(updater->_hReadPipe, NULL, 0, NULL, &bytesAvailable, NULL) && bytesAvailable > 0) if (ReadFile(updater->_hReadPipe, chBuf, BUFSIZE - 1, &dwRead, NULL) && dwRead) { chBuf[dwRead] = '\0'; output += chBuf; LOG_DEBUG << output; updater->parse(output); } if (!GetExitCodeThread(updater->_pi.hThread, &ec) || ec != STILL_ACTIVE) break; } updater->AddProgressInfo(prog_info::PROGRESS_END); updater->DestroyHandle(); return 0; }