Don't fail if the game process went away before we were ready to wait for it.

This commit is contained in:
Ryan C. Gordon 2017-06-02 01:32:33 -04:00
parent b5c54ec019
commit cd4aa2d9a9
1 changed files with 6 additions and 1 deletions

View File

@ -189,7 +189,12 @@ static void windowsWaitForProcessToDie(const DWORD pid)
infof("Waiting on process ID #%u", (unsigned int) pid);
h = OpenProcess(SYNCHRONIZE, FALSE, pid);
if (!h) {
// !!! FIXME: what does this return if process is already dead?
const DWORD err = GetLastError();
if (err == ERROR_INVALID_PARAMETER) {
info("No such process; probably already dead. Carry on.");
return; /* process is (probably) already gone. */
}
infof("OpenProcess failed. err=%d", (unsigned int) err);
die("OpenProcess failed");
}
if (WaitForSingleObject(h, INFINITE) != WAIT_OBJECT_0) {