windows: report uv_process_t exit code correctly

A stupid oversight in 66ae0ff would cause a random value to be reported
as the exit code for a 'normally exited' child process.
This commit is contained in:
Bert Belder 2013-08-24 16:24:14 +02:00
parent d8a3ed6cd0
commit d667653f77

View File

@ -729,7 +729,7 @@ static void CALLBACK exit_wait_callback(void* data, BOOLEAN didTimeout) {
/* Called on main thread after a child process has exited. */
void uv_process_proc_exit(uv_loop_t* loop, uv_process_t* handle) {
int exit_code;
int64_t exit_code;
DWORD status;
assert(handle->exit_cb_pending);
@ -755,7 +755,9 @@ void uv_process_proc_exit(uv_loop_t* loop, uv_process_t* handle) {
if (handle->spawn_error) {
/* Spawning failed. */
exit_code = uv_translate_sys_error(handle->spawn_error);
} else if (!GetExitCodeProcess(handle->process_handle, &status)) {
} else if (GetExitCodeProcess(handle->process_handle, &status)) {
exit_code = status;
} else {
/* Unable to to obtain the exit code. This should never happen. */
exit_code = uv_translate_sys_error(GetLastError());
}