Beispiel #1
0
int pipelineWait(struct pipeline *pl)
/* Wait for processes in a pipeline to complete; normally aborts if any
 * process exists non-zero.  If pipelineNoAbort was specified, return the exit
 * code of the first process exit non-zero, or zero if none failed. */
{
struct plProc *proc;
int exitCode = 0;

/* must close before waits for output pipeline */
if (pl->options & pipelineWrite)
    closePipeline(pl);

/* wait on each process in order */
for (proc = pl->procs; proc != NULL; proc = proc->next)
    {
    plProcWait(proc);
    if ((WEXITSTATUS(proc->status) != 0) && (exitCode == 0))
        exitCode = WEXITSTATUS(proc->status);
    }

/* must close after waits for input pipeline */
if (pl->options & pipelineRead)
    closePipeline(pl);

return exitCode;
}
Beispiel #2
0
int pipelineWait(struct pipeline *pl)
/* Wait for processes in a pipeline to complete; normally aborts if any
 * process exists non-zero.  If pipelineNoAbort was specified, return the exit
 * code of the first process exit non-zero, or zero if none failed. */
{
/* must close before waiting to so processes get pipe EOF */
closePipeline(pl);
return groupLeaderWait(pl);
}