autodriver/autodriver.c
void monitor_streaming_feedback(char *file, pid_t tail_pid) {
    while (true) {
        sleep(5);

        struct stat buf;
        if (stat(file, &buf) < 0) {
            ERROR_ERRNO("Statting output file in monitor");
            exit(EXIT_OSERROR);
        }

        // Kill tail process if we have exceeded file size
        if (args.osize > 0 && buf.st_size > args.osize) {
            if (kill(tail_pid, SIGUSR2) < 0) {
                ERROR_ERRNO("Killing tail process");
                exit(EXIT_OSERROR);
            }

            // We want to indicate in the output that progress is terminated.
            fprintf(stdout, "---- TRUNCATING OUTPUT (too long!) ----");
            exit(0);
        }
    }
}
/**
 * @brief Kill tail_pid when size of file exceeds output limit.
 * Checks once every 5 seconds.
 * Doesn't return (exits once truncated).
 */
@brief Kill tail_pid when size of file exceeds output limit.
Checks once every 5 seconds.
Doesn't return (exits once truncated).
@brief Kill tail_pid when size of file exceeds output limit . Checks once every 5 seconds . Doesn ' t return ( exits once truncated ) .
void monitor_streaming_feedback(char *file, pid_t tail_pid) {
    while (true) {
        sleep(5);
        struct stat buf;
        if (stat(file, &buf) < 0) {
            ERROR_ERRNO("Statting output file in monitor");
            exit(EXIT_OSERROR);
        }
        if (args.osize > 0 && buf.st_size > args.osize) {
            if (kill(tail_pid, SIGUSR2) < 0) {
                ERROR_ERRNO("Killing tail process");
                exit(EXIT_OSERROR);
            }
            fprintf(stdout, "---- TRUNCATING OUTPUT (too long!) ----");
            exit(0);
        }
    }
}
void monitor_streaming_feedback ( char * file , pid_t tail_pid ) { while ( true ) { sleep ( 5 ) ; struct stat buf ; if ( stat ( file , & buf ) < 0 ) { ERROR_ERRNO ( " " ) ; exit ( EXIT_OSERROR ) ; } if ( args . osize > 0 && buf . st_size > args . osize ) { if ( kill ( tail_pid , SIGUSR2 ) < 0 ) { ERROR_ERRNO ( " " ) ; exit ( EXIT_OSERROR ) ; } fprintf ( stdout , " " ) ; exit ( 0 ) ; } } }
@brief Kill tail_pid when size of file exceeds output limit.
@brief Kill tail_pid when size of file exceeds output limit .
// Kill tail process if we have exceeded file size // We want to indicate in the output that progress is terminated.