I got a pipe.
int anotherPipe; make(anotherPipe);
Both of the following processes have access to this pipe.
close(anotherPipe); dup2(anotherPipe, 1); //redirect stdout to pipe execl("/usr/bin/who", "usr/bin/who", NULL); close(anotherPipe); //this is never executed
close(anotherPipe); read(anotherPipe, stringbuffer, bytestoread); printf("%s\n", buffer); printf("checkpoint\n"); close(anotherPipe);
The "who" command's output from execl is redirected to process B via pipe, where it is printed. But now my process B is not terminating, although the checkpoint is printed.
By 'not terminating' I mean that the following is not displayed in the terminal:
What is happening here and how is it solved?
EDIT: Solved the issue with the non-terminating process B. It terminated, but my top level process finished before A and B, so the
was printed a lot earlier. I used waitpid() and now everything is fine.