Skip to content

Commit

Permalink
Check for child process's error code.
Browse files Browse the repository at this point in the history
  • Loading branch information
uditagarwal97 committed Mar 18, 2024
1 parent 3230e18 commit 4f56083
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion sycl/tools/sycl-ls/sycl-ls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,19 @@ static int unsetFilterEnvVarsAndFork() {
// Wait for child process to finish.
WaitForSingleObject(pi.hProcess, INFINITE);

// Check child process's exit code and propagate it.
DWORD exitCode;
if (!GetExitCodeProcess(pi.hProcess, &exitCode)) {
std::cerr << "Error getting exit code. Aborting!" << std::endl;
return EXIT_FAILURE;
}

assert(exitCode != STILL_ACTIVE &&
"The child process should have already terminated");

CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
return EXIT_SUCCESS;
return exitCode;
}
#endif

Expand Down

0 comments on commit 4f56083

Please sign in to comment.