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().
This commit is contained in:
parent
83910d3b9c
commit
05e8c1a3c5
1 changed files with 2 additions and 1 deletions
|
@ -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) {
|
||||||
if (exit_code) {
|
if (exit_code) {
|
||||||
*exit_code = code;
|
*exit_code = code;
|
||||||
}
|
}
|
||||||
|
CloseHandle(handle);
|
||||||
return !code;
|
return !code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue