This commit is contained in:
Krzosa Karol
2024-07-12 10:34:17 +02:00
parent bd97ecb9eb
commit 1ec217905d
5 changed files with 205 additions and 18 deletions

View File

@@ -57,10 +57,16 @@ Process RunEx(String args) {
DWORD dw = GetLastError();
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, dw, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR)&lpMsgBuf, 0, NULL);
LocalFree(lpMsgBuf);
char *buff = (char *)lpMsgBuf;
size_t buffLen = strlen((const char *)buff);
if (buffLen > 0 && buff[buffLen - 1] == '\n') {
buff[buffLen - 1] = 0;
}
// @warning: leak! but we don't care
result.error_message = Format(GetSystemAllocator(), "Failed to create process | message: %s | cmd: %.*s", (char *)lpMsgBuf, FmtString(args));
LocalFree(lpMsgBuf);
}
return result;
}