if (pid == 0) {
    //child process; read from pipe and write to stdin of validate
    close(pipefd[1]);
    
    if (dup2(pipefd[0], STDIN_FILENO) == -1) {
        perror("Dup2 failed");
        exit(1);
    }
    close(pipefd[0]);
    execl("./validate", "validate", NULL);
  }