model/model_viz: use OrderedTree[MConcern]
[nit.git] / c_src / exec_nit.c
index c808105..93f5f9b 100644 (file)
@@ -26,22 +26,19 @@ se_exec_data_t* exec_Process_Process_basic_exec_execute_4(void *s, char *prog, c
        if (pipeflag & 1) {
                int res = pipe(in_fd);
                if ( res == -1 ) {
-                       fprintf( stderr, "Pipe init failed in Process:basic_exec_execute: %s\n", strerror( errno ) );
-                       exit(1);
+                       return NULL;
                }
        }
        if (pipeflag & 2) {
                int res = pipe(out_fd);
                if ( res == -1 ) {
-                       fprintf( stderr, "Pipe init failed in Process:basic_exec_execute: %s\n", strerror( errno ) );
-                       exit(1);
+                       return NULL;
                }
        }
        if (pipeflag & 4) {
                int res = pipe(err_fd);
                if ( res == -1 ) {
-                       fprintf( stderr, "Pipe init failed in Process:basic_exec_execute: %s\n", strerror( errno ) );
-                       exit(1);
+                       return NULL;
                }
        }
                                        
@@ -85,7 +82,7 @@ se_exec_data_t* exec_Process_Process_basic_exec_execute_4(void *s, char *prog, c
 
                /* calls */
                execvp(prog, arg);
-               abort();
+               _exit(127);
        }
        else if (id > 0)
                { /* father */
@@ -145,3 +142,12 @@ void exec_NativeProcess_NativeProcess_wait_0(void*d) {
                data->running = 0;
        }
 }
+
+int string_NativeString_NativeString_system_0(const char *cmd) {
+       int status = system(cmd);
+       if (WIFSIGNALED(status) && WTERMSIG(status) == SIGINT) {
+               // cmd exited on SIGINT: in my opinion the user wants the main to be discontinued
+               kill(getpid(), SIGINT);
+       }
+       return status;
+}