2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-07-05 23:15:52 +00:00

Make console API errors non-fatal

This commit is contained in:
Jack Andersen 2016-12-25 12:50:11 -10:00
parent 77c3d1e184
commit ecb722ae43

View File

@ -329,17 +329,18 @@ BlenderConnection::BlenderConnection(int verbosityLevel)
if (!ReadFile(consoleOutRead, lpBuffer, sizeof(lpBuffer),
&nBytesRead, NULL) || !nBytesRead)
{
if (GetLastError() == ERROR_BROKEN_PIPE)
DWORD err = GetLastError();
if (err == ERROR_BROKEN_PIPE)
break; // pipe done - normal exit path.
else
BlenderLog.report(logvisor::Fatal, "Error with ReadFile"); // Something bad happened.
BlenderLog.report(logvisor::Error, "Error with ReadFile: %08X", err); // Something bad happened.
}
// Display the character read on the screen.
auto lk = logvisor::LockLog();
if (!WriteConsoleA(GetStdHandle(STD_OUTPUT_HANDLE), lpBuffer,
nBytesRead, &nCharsWritten, NULL))
BlenderLog.report(logvisor::Fatal, "Error with WriteConsole");
BlenderLog.report(logvisor::Error, "Error with WriteConsole: %08X", GetLastError());
}
CloseHandle(consoleOutRead);