浏览代码

Fixed exit code retrieval of spawned processes on Windows

Use GetExitCodeProcess() on Windows to retrieve the exit code of a process in
OS:excute()
Marcus Brummer 4 年之前
父节点
当前提交
f0f4220b05
共有 1 个文件被更改,包括 3 次插入1 次删除
  1. 3 1
      platform/windows/os_windows.cpp

+ 3 - 1
platform/windows/os_windows.cpp

@@ -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;
 		}
 		}