lib/process: Add add_stderr flag to process module
[petitboot] / lib / process / process.c
index 1a16fb6312b4fb74dc8cc753806009e939bd7691..3c81b29340f8ae69ccd99f4ebe10133eb408e47d 100644 (file)
@@ -125,7 +125,10 @@ static void process_setup_stdout_child(struct process_info *procinfo)
        else
                dup2(log, STDOUT_FILENO);
 
        else
                dup2(log, STDOUT_FILENO);
 
-       dup2(log, STDERR_FILENO);
+       if (procinfo->process.keep_stdout && procinfo->process.add_stderr)
+               dup2(procinfo->stdout_pipe[1], STDERR_FILENO);
+       else
+               dup2(log, STDERR_FILENO);
 }
 
 static void process_finish_stdout(struct process_info *procinfo)
 }
 
 static void process_finish_stdout(struct process_info *procinfo)