tests.sh: add NIT_TESTING_ID with the same semantic than with nitunit
[nit.git] / c_src / core__exec._ffi.c
1 /*
2 Extern implementation of Nit module exec
3 */
4 #include <stdlib.h>
5 #include <stdio.h>
6 #include <stdint.h>
7 #include "core__exec._ffi.h"
8 #ifdef ANDROID
9 #include <android/log.h>
10 #define PRINT_ERROR(...) (void)__android_log_print(ANDROID_LOG_WARN, "Nit", __VA_ARGS__)
11 #else
12 #define PRINT_ERROR(...) fprintf(stderr, __VA_ARGS__)
13 #endif
14 #line 19 "../lib/core/exec.nit"
15
16
17 #include <stdlib.h>
18 #include <string.h>
19 #include <errno.h>
20 #include <stdio.h>
21 #include <unistd.h>
22 #include <sys/wait.h>
23 #include <signal.h>
24 long exec___NativeString_system___impl( char* self )
25 {
26 #line 332 "../lib/core/exec.nit"
27
28
29 int status = system(self);
30 if (WIFSIGNALED(status) && WTERMSIG(status) == SIGINT) {
31 // system exited on SIGINT: in my opinion the user wants the main to be discontinued
32 kill(getpid(), SIGINT);
33 }
34 return status;
35 }