core :: NativeProcess :: defaultinit
core :: NativeProcess :: err_fd
core :: NativeProcess :: id
core :: NativeProcess :: in_fd
core :: NativeProcess :: is_finished
core :: NativeProcess :: out_fd
core :: NativeProcess :: status
core :: NativeProcess :: wait
core $ NativeProcess :: SELF
Type of this instance, automatically specialized in every classcore :: Pointer :: address_is_null
Is the address behind this Object at NULL?core :: Object :: class_factory
Implementation used byget_class
to create the specific class.
core :: NativeProcess :: defaultinit
core :: Object :: defaultinit
core :: Pointer :: defaultinit
core :: NativeProcess :: err_fd
core :: NativeProcess :: id
core :: NativeProcess :: in_fd
core :: NativeProcess :: is_finished
core :: Object :: is_same_instance
Return true ifself
and other
are the same instance (i.e. same identity).
core :: Object :: is_same_serialized
Isself
the same as other
in a serialization context?
core :: Object :: is_same_type
Return true ifself
and other
have the same dynamic type.
core :: Object :: native_class_name
The class name of the object in CString format.core :: Pointer :: native_equals
core :: NativeProcess :: out_fd
core :: Object :: output_class_name
Display class name on stdout (debug only).core :: Pointer :: premultiply_alpha
Multiply RGB values by their alpha valuecore :: NativeProcess :: status
core :: NativeProcess :: wait
private extern class NativeProcess `{ se_exec_data_t* `}
fun id: Int `{ return (long)self->id; `}
fun status: Int `{ return self->status; `}
fun in_fd: Int `{ return self->in_fd; `}
fun out_fd: Int `{ return self->out_fd; `}
fun err_fd: Int `{ return self->err_fd; `}
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;
`}
fun wait `{
#ifdef _WIN32
long unsigned int status;
if (self->running) {
WaitForSingleObject(self->h_process, INFINITE);
GetExitCodeProcess(self->h_process, &status);
CloseHandle(self->h_process);
CloseHandle(self->h_thread);
self->status = (int)status;
self->running = 0;
}
#else
int status;
if (self->running) {
waitpid(self->id, &status, 0);
self->status = WEXITSTATUS(status);
self->running = 0;
}
#endif
`}
end
lib/core/exec.nit:477,1--540,3