
void execute_action(Action *action) {
    int r = fork();

    if (r == 0) {
        char *executable = malloc(sizeof(char) * MAXLINE);
        args_to_string(action->args, buffer, MAXLINE);
        fprintf(stdout, "%s\n", buffer);
        execvp(action->args[0], action->args);
        exit(0);
    } else if (r > 0) {
        wait(&status);
        if (wait(&status) == -1) {
            perror("wait");
        }

        if (WIFSIGNALED(status)) {
            perror("fork");
            exit(1);
        }
    } else {
        perror("fork");
        exit(1);
    }
}