1 /* This file is part of NIT ( http://www.nitlanguage.org ).
3 * Copyright 2004-2008 Jean Privat <jean@pryen.org>
5 * This file is free software, which comes along with NIT. This software is
6 * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
7 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
8 * PARTICULAR PURPOSE. You can modify it is you want, provided this header
9 * is kept unaltered, and a notification of the changes is added.
10 * You are allowed to redistribute it and sell it, alone or is a part of
18 se_exec_data_t
* exec_Process_Process_basic_exec_execute_4(int c
, char *prog
, char *args
, int len
, int pipeflag
) {
19 se_exec_data_t
* result
= NULL
;
34 char **arg
= malloc(sizeof(char*) * (len
+1));
75 result
= (se_exec_data_t
*)malloc(sizeof(se_exec_data_t
));
80 result
->in_fd
= in_fd
[1];
87 result
->out_fd
= out_fd
[0];
94 result
->err_fd
= err_fd
[0];
102 int exec_NativeProcess_NativeProcess_is_finished_0(void*d
) {
103 se_exec_data_t
*data
= (se_exec_data_t
*)d
;
107 int id
= waitpid(data
->id
, &status
, WNOHANG
);
109 /* child is finished */
110 result
= (int)(id
== data
->id
);
111 data
->status
= WEXITSTATUS(status
);
121 void exec_NativeProcess_NativeProcess_wait_0(void*d
) {
122 se_exec_data_t
*data
= (se_exec_data_t
*)d
;
125 waitpid(data
->id
, &status
, 0);
126 data
->status
= WEXITSTATUS(status
);