Skip to content

Commit

Permalink
refactor: refactoring StdoutRedirector
Browse files Browse the repository at this point in the history
  • Loading branch information
OEOTYAN committed Aug 11, 2024
1 parent 72320b2 commit eac1156
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 6 additions & 0 deletions src-client/ll/core/main.cpp
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
#include "windows.h"

BOOL APIENTRY DllMain(HMODULE hModule, DWORD ulReasonForCall, LPVOID lpReserved) {
if (ulReasonForCall != DLL_PROCESS_ATTACH) return TRUE;

return TRUE;
}
5 changes: 2 additions & 3 deletions src/ll/api/io/StdoutRedirector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,9 @@ std::string StdoutRedirector::read() {

fSuccess = ReadFile(hRead, buf, sizeof(buf), &cbRead, NULL);

result.append(buf, cbRead);
if (cbRead > 0) result.append(buf, cbRead);

if (!fSuccess && GetLastError() != ERROR_MORE_DATA) break;
} while (!fSuccess); // repeat loop if ERROR_MORE_DATA
} while (GetLastError() == ERROR_MORE_DATA); // repeat loop if ERROR_MORE_DATA
return result;
}
} // namespace ll::io

0 comments on commit eac1156

Please sign in to comment.