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
20 se_exec_data_t
* exec_Process_Process_basic_exec_execute_4(void *s
, char *prog
, char *args
, int len
, int pipeflag
) {
21 se_exec_data_t
* result
= NULL
;
27 int res
= pipe(in_fd
);
33 int res
= pipe(out_fd
);
39 int res
= pipe(err_fd
);
48 char **arg
= malloc(sizeof(char*) * (len
+1));
89 result
= (se_exec_data_t
*)malloc(sizeof(se_exec_data_t
));
94 result
->in_fd
= in_fd
[1];
101 result
->out_fd
= out_fd
[0];
108 result
->err_fd
= err_fd
[0];
117 int exec_NativeProcess_NativeProcess_is_finished_0(void*d
) {
118 se_exec_data_t
*data
= (se_exec_data_t
*)d
;
122 int id
= waitpid(data
->id
, &status
, WNOHANG
);
124 /* child is finished */
125 result
= (int)(id
== data
->id
);
126 data
->status
= WEXITSTATUS(status
);
136 void exec_NativeProcess_NativeProcess_wait_0(void*d
) {
137 se_exec_data_t
*data
= (se_exec_data_t
*)d
;
140 waitpid(data
->id
, &status
, 0);
141 data
->status
= WEXITSTATUS(status
);