diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index b108d74b2e3..646bc3aa4cb 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -466,8 +466,10 @@ Error OS_Windows::execute(const String &p_path, const List &p_arguments, ERR_FAIL_COND_V(ret == 0, ERR_CANT_FORK); if (p_blocking) { - DWORD ret2 = WaitForSingleObject(pi.pi.hProcess, INFINITE); + WaitForSingleObject(pi.pi.hProcess, INFINITE); if (r_exitcode) { + DWORD ret2; + GetExitCodeProcess(pi.pi.hProcess, &ret2); *r_exitcode = ret2; }