The page "Job Control/Implementing a shell/Launching Jobs" contains a code snippet on how to launch a job. In this code snippet, a newly launched process tries to call exec before it knows that the entire pipeline has been created. This is a bug, because a process may change it's session or otherwise change it status in a way that will make the shell unable to correctly set the process group of the following programs in the pipeline. Simple pipelines like 'ls -la --color|more' seem to break from this, which is strange since ls shouldn't do anything strange. Therefore, each process should wait for the shell to tell them that they can launch before calling exec. My proposed method for doing this is to change the code snippet if (pgid == 0) pgid = pid; setpgid (pid, pgid); if (foreground) tcsetpgrp (shell_terminal, pgid); into while( getpgid(pid) != pgid ) sleep(0); if (foreground) { while( tcgetpgrp( 0 ) != pgid ) sleep(0); } but there may be other issues with that code.