GedlekPawel-lab4/zad1/mainchild.c
void execSH() {
    pid_t pid = fork();
    if(pid < 0)
        perror("Error during executing fork()");

    else if(pid > 0)
        childPID = pid;
    else {
        // Ignores both signals that would be sent to process from shell if user typed keyboard signal keys
        signal(SIGINT, SIG_IGN);
        signal(SIGTSTP, SIG_IGN);
        if(execlp(scriptname, scriptname, NULL) == -1) {
            perror("Error during executing script");
            exit(1);
        }
    }
}
// Forks and executes passed script in child process
Forks and executes passed script in child process
Forks and executes passed script in child process
void execSH() {
    pid_t pid = fork();
    if(pid < 0)
        perror("Error during executing fork()");
    else if(pid > 0)
        childPID = pid;
    else {
        signal(SIGINT, SIG_IGN);
        signal(SIGTSTP, SIG_IGN);
        if(execlp(scriptname, scriptname, NULL) == -1) {
            perror("Error during executing script");
            exit(1);
        }
    }
}
void execSH ( ) { pid_t pid = fork ( ) ; if ( pid < 0 ) perror ( " " ) ; else if ( pid > 0 ) childPID = pid ; else { signal ( SIGINT , SIG_IGN ) ; signal ( SIGTSTP , SIG_IGN ) ; if ( execlp ( scriptname , scriptname , NULL ) == -1 ) { perror ( " " ) ; exit ( 1 ) ; } } }
Forks and executes passed script in child process
Forks and executes passed script in child process
// Ignores both signals that would be sent to process from shell if user typed keyboard signal keys