Fixed exit code retrieval of spawned processes on Windows

Use GetExitCodeProcess() on Windows to retrieve the exit code of a process in
OS:excute()

(cherry picked from commit f0f4220b05)
This commit is contained in:
Marcus Brummer 2020-11-16 18:26:57 +01:00 committed by Rémi Verschelde
parent 3a46e01af3
commit a822bb9844
No known key found for this signature in database
GPG key ID: C3336907360768E1

View file

@ -2944,9 +2944,10 @@ Error OS_Windows::execute(const String &p_path, const List<String> &p_arguments,
ERR_FAIL_COND_V(ret == 0, ERR_CANT_FORK); ERR_FAIL_COND_V(ret == 0, ERR_CANT_FORK);
if (p_blocking) { if (p_blocking) {
WaitForSingleObject(pi.pi.hProcess, INFINITE);
DWORD ret2 = WaitForSingleObject(pi.pi.hProcess, INFINITE);
if (r_exitcode) { if (r_exitcode) {
DWORD ret2;
GetExitCodeProcess(pi.pi.hProcess, &ret2);
*r_exitcode = ret2; *r_exitcode = ret2;
} }