When the input is something like "ls" the program just hangs. I thought that is was the wait statement that made this so, so I took it out, im still getting the same results.Code:Bool execute_command(char *input) { pid_t child_pid; /* fork() == 0 for child process */ if(child_pid == 0) { char *argv[]={input, 0}; execvp(argv[0], argv); perror("execvp() failure!\n"); printf("This print is after execl() and should not get executed\n"); _exit(EXIT_FAILURE); } else if(child_pid > 0) { wait(0); return(TRUE); } else { perror("Fork Error. Quitting the Programing.\n"); exit(EXIT_FAILURE); } }



LinkBack URL
About LinkBacks


