diff --git contrib/bmake/job.c contrib/bmake/job.c index 20f693a..45fcd95 100644 --- contrib/bmake/job.c +++ contrib/bmake/job.c @@ -1386,14 +1386,6 @@ JobExec(Job *job, char **argv) } /* - * Set up the child's output to be routed through the pipe - * we've created for it. - */ - if (dup2(job->outPipe, 1) == -1) { - execError("dup2", "job->outPipe"); - _exit(1); - } - /* * The output channels are marked close on exec. This bit was * duplicated by the dup2(on some systems), so we have to clear * it before routing the shell's error output to the same place as @@ -1406,6 +1398,15 @@ JobExec(Job *job, char **argv) } /* + * Set up the child's output to be routed through the pipe + * we've created for it. + */ + if (dup2(job->outPipe, 1) == -1) { + execError("dup2", "job->outPipe"); + _exit(1); + } + + /* * We want to switch the child into a different process family so * we can kill it and all its descendants in one fell swoop, * by killing its process family, but not commit suicide.