提交 05e8c1a3 编写于 作者: R Romain Vimont

Call CloseHandle() after wait on Windows

TerminateProcess() is "equivalent" to kill(), while
WaitForSingleObject() is "equivalent" to waitpid(), so the handle must
be closed after WaitForSingleObject().
上级 83910d3b
...@@ -56,7 +56,7 @@ cmd_execute(const char *const argv[], HANDLE *handle) { ...@@ -56,7 +56,7 @@ cmd_execute(const char *const argv[], HANDLE *handle) {
bool bool
cmd_terminate(HANDLE handle) { cmd_terminate(HANDLE handle) {
return TerminateProcess(handle, 1) && CloseHandle(handle); return TerminateProcess(handle, 1);
} }
bool bool
...@@ -70,6 +70,7 @@ cmd_simple_wait(HANDLE handle, DWORD *exit_code) { ...@@ -70,6 +70,7 @@ cmd_simple_wait(HANDLE handle, DWORD *exit_code) {
if (exit_code) { if (exit_code) {
*exit_code = code; *exit_code = code;
} }
CloseHandle(handle);
return !code; return !code;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册