2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-07-05 19:55:51 +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), if (!ReadFile(consoleOutRead, lpBuffer, sizeof(lpBuffer),
&nBytesRead, NULL) || !nBytesRead) &nBytesRead, NULL) || !nBytesRead)
{ {
if (GetLastError() == ERROR_BROKEN_PIPE) DWORD err = GetLastError();
break; // pipe done - normal exit path. if (err == ERROR_BROKEN_PIPE)
else break; // pipe done - normal exit path.
BlenderLog.report(logvisor::Fatal, "Error with ReadFile"); // Something bad happened. else
BlenderLog.report(logvisor::Error, "Error with ReadFile: %08X", err); // Something bad happened.
} }
// Display the character read on the screen. // Display the character read on the screen.
auto lk = logvisor::LockLog(); auto lk = logvisor::LockLog();
if (!WriteConsoleA(GetStdHandle(STD_OUTPUT_HANDLE), lpBuffer, if (!WriteConsoleA(GetStdHandle(STD_OUTPUT_HANDLE), lpBuffer,
nBytesRead, &nCharsWritten, NULL)) nBytesRead, &nCharsWritten, NULL))
BlenderLog.report(logvisor::Fatal, "Error with WriteConsole"); BlenderLog.report(logvisor::Error, "Error with WriteConsole: %08X", GetLastError());
} }
CloseHandle(consoleOutRead); CloseHandle(consoleOutRead);