Merge pull request #43595 from mbrlabs/windows-execute-fix

Fixed exit code retrieval of spawned processes on Windows
This commit is contained in:
Rémi Verschelde 2020-11-16 22:16:25 +01:00 committed by GitHub
commit 900e5ffdd8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -466,8 +466,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) {
DWORD ret2 = WaitForSingleObject(pi.pi.hProcess, INFINITE); WaitForSingleObject(pi.pi.hProcess, INFINITE);
if (r_exitcode) { if (r_exitcode) {
DWORD ret2;
GetExitCodeProcess(pi.pi.hProcess, &ret2);
*r_exitcode = ret2; *r_exitcode = ret2;
} }