Skip to content

Commit 8bd432c

Browse files
Improve the test watcher
1 parent 66fe4a6 commit 8bd432c

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

src/native/watchdog/watchdog.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ int main(const int argc, const char *argv[])
4141
const long timeout_mins = strtol(argv[1], nullptr, 10);
4242
int exit_code = run_timed_process(timeout_mins * 60000L, argc-2, &argv[2]);
4343

44-
printf("App Exit Code: %d\n", exit_code);
44+
printf("Exit Code: %d\n", exit_code);
4545
return exit_code;
4646
}
4747

@@ -58,7 +58,6 @@ int run_timed_process(const long timeout_ms, const int proc_argc, const char *pr
5858

5959
STARTUPINFOA startup_info;
6060
PROCESS_INFORMATION proc_info;
61-
unsigned long exit_code;
6261

6362
ZeroMemory(&startup_info, sizeof(startup_info));
6463
startup_info.cb = sizeof(startup_info);
@@ -72,7 +71,11 @@ int run_timed_process(const long timeout_ms, const int proc_argc, const char *pr
7271
return error_code;
7372
}
7473

75-
WaitForSingleObject(proc_info.hProcess, timeout_ms);
74+
if (WaitForSingleObject(proc_info.hProcess, timeout_ms) == WAIT_TIMEOUT)
75+
{
76+
printf("Child process took too long. Timed out...\n");
77+
}
78+
DWORD exit_code;
7679
GetExitCodeProcess(proc_info.hProcess, &exit_code);
7780

7881
CloseHandle(proc_info.hProcess);

0 commit comments

Comments
 (0)