mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[platform] more Windows restarter logging (IDEA-CR-17138)
This commit is contained in:
@@ -21,11 +21,13 @@
|
||||
|
||||
|
||||
#define PROVIDER_NAME L"JB-Restarter"
|
||||
#define ERR_OPEN_PROCESS (0xE0000000 + 101)
|
||||
#define ERR_COMMAND_TOO_LONG (0xE0000000 + 102)
|
||||
#define ERR_CREATE_PROCESS (0xE0000000 + 103)
|
||||
#define ERR_GET_EXIT_CODE (0xE0000000 + 104)
|
||||
#define WARN_COMMAND_FAILED (0x80000000 + 201)
|
||||
#define ERR_OPEN_PROCESS (0xE0000000 + 100)
|
||||
#define ERR_MAIN_WAIT_FAILED (0xE0000000 + 101)
|
||||
#define ERR_COMMAND_TOO_LONG (0xE0000000 + 110)
|
||||
#define ERR_CREATE_PROCESS (0xE0000000 + 111)
|
||||
#define ERR_COMMAND_WAIT_FAILED (0xE0000000 + 112)
|
||||
#define ERR_GET_EXIT_CODE (0xE0000000 + 113)
|
||||
#define WARN_COMMAND_FAILED (0x80000000 + 200)
|
||||
|
||||
#define COMMAND_SIZE 32768
|
||||
#define MESSAGE_SIZE (COMMAND_SIZE + 1024)
|
||||
@@ -67,12 +69,18 @@ int wmain(int argc, wchar_t *argv[]) {
|
||||
|
||||
static void wait_for_parent(const wchar_t *pid_arg) {
|
||||
int pid = (int)wcstol(pid_arg, NULL, 10);
|
||||
|
||||
HANDLE parent = OpenProcess(SYNCHRONIZE, FALSE, pid);
|
||||
if (parent == NULL) {
|
||||
log_event(ERR_OPEN_PROCESS, "OpenProcess(%d): %d", pid, (int)GetLastError());
|
||||
return;
|
||||
}
|
||||
WaitForSingleObject(parent, INFINITE);
|
||||
|
||||
DWORD res = WaitForSingleObject(parent, INFINITE);
|
||||
if (res != WAIT_OBJECT_0) {
|
||||
log_event(ERR_MAIN_WAIT_FAILED, "WaitForSingleObject: %08X/%d", (unsigned int)res, (int)GetLastError());
|
||||
}
|
||||
|
||||
CloseHandle(parent);
|
||||
}
|
||||
|
||||
@@ -103,7 +111,10 @@ static void run_command(int cmd_argc, wchar_t *cmd_argv[], BOOL last) {
|
||||
}
|
||||
|
||||
if (!last) {
|
||||
WaitForSingleObject(pi.hProcess, INFINITE);
|
||||
DWORD res = WaitForSingleObject(pi.hProcess, INFINITE);
|
||||
if (res != WAIT_OBJECT_0) {
|
||||
log_event(ERR_COMMAND_WAIT_FAILED, "WaitForSingleObject: %08X/%d", (unsigned int)res, (int)GetLastError());
|
||||
}
|
||||
|
||||
DWORD ec;
|
||||
if (!GetExitCodeProcess(pi.hProcess, &ec)) {
|
||||
|
||||
Reference in New Issue
Block a user