Have start_command() create a pipe to read the stderr of the child.

This adds another stanza that allocates a pipe that is connected to the
child's stderr and that the caller can read from. In order to request this
pipe, the caller sets cmd->err to -1.

The implementation is not exactly modeled after the stdout case: For stdout
the caller can supply an existing file descriptor, but this facility is
nowhere needed in the stderr case. Additionally, the caller is required to
close cmd->err.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
This commit is contained in:
Johannes Sixt
2007-10-19 21:47:58 +02:00
committed by Shawn O. Pearce
parent 477822c35d
commit f3b33f1d22
2 changed files with 25 additions and 2 deletions

View File

@@ -16,6 +16,7 @@ struct child_process {
pid_t pid;
int in;
int out;
int err;
const char *dir;
const char *const *env;
unsigned close_in:1;