summaryrefslogtreecommitdiff
path: root/build.c
blob: b8740fcd61afba986aa3c9e38e907f1758e46c47 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <sys/wait.h>
#include <unistd.h>

int main() {
  if (fork() == 0) {
    char* args[] = {"gcc", "src/main.c", "-o", "main.o", NULL};
    execvp(args[0], args);
    return 0;
  } else {
    wait(NULL);
  }

  char* args[] = {"./main.o", NULL};
  execvp(args[0], args);
  return 0;
}