core :: NativeProcess :: is_finished
fun is_finished: Bool `{
int result = (int)0;
if (self->running) {
#ifdef _WIN32
if (WaitForSingleObject(self->h_process, 0) == 0) {
/* child is finished */
result = 1;
long unsigned int status;
GetExitCodeProcess(self->h_process, &status);
self->running = 0;
self->status = (int)status;
CloseHandle(self->h_process);
CloseHandle(self->h_thread);
}
#else
int status;
int id = waitpid(self->id, &status, WNOHANG);
if (id != 0) {
/* child is finished */
result = (int)(id == self->id);
self->status = WEXITSTATUS(status);
self->running = 0;
}
#endif
}
else{
result = (int)1;
}
return result;
`}
lib/core/exec.nit:485,2--516,3