summaryrefslogtreecommitdiff
path: root/run-command.c
diff options
context:
space:
mode:
authorStefan Beller <sbeller@google.com>2016-03-01 02:07:15 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-03-01 19:57:19 (GMT)
commit2dac9b5637abe580e8b8ea36e00dbbf28ec99af6 (patch)
tree57b46bdae2fad445c5d06538e7bae6b4de59f16c /run-command.c
parent8c6b5491182510f2344dae71784fcb5c3992d005 (diff)
downloadgit-2dac9b5637abe580e8b8ea36e00dbbf28ec99af6.zip
git-2dac9b5637abe580e8b8ea36e00dbbf28ec99af6.tar.gz
git-2dac9b5637abe580e8b8ea36e00dbbf28ec99af6.tar.bz2
run_processes_parallel: treat output of children as byte array
We do not want the output to be interrupted by a NUL byte, so we cannot use raw fputs. Introduce strbuf_write to avoid having long arguments in run-command.c. Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'run-command.c')
-rw-r--r--run-command.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/run-command.c b/run-command.c
index 8e3ad07..bdda940 100644
--- a/run-command.c
+++ b/run-command.c
@@ -994,7 +994,7 @@ static void pp_cleanup(struct parallel_processes *pp)
* When get_next_task added messages to the buffer in its last
* iteration, the buffered output is non empty.
*/
- fputs(pp->buffered_output.buf, stderr);
+ strbuf_write(&pp->buffered_output, stderr);
strbuf_release(&pp->buffered_output);
sigchain_pop_common();
@@ -1079,7 +1079,7 @@ static void pp_output(struct parallel_processes *pp)
int i = pp->output_owner;
if (pp->children[i].state == GIT_CP_WORKING &&
pp->children[i].err.len) {
- fputs(pp->children[i].err.buf, stderr);
+ strbuf_write(&pp->children[i].err, stderr);
strbuf_reset(&pp->children[i].err);
}
}
@@ -1117,11 +1117,11 @@ static int pp_collect_finished(struct parallel_processes *pp)
strbuf_addbuf(&pp->buffered_output, &pp->children[i].err);
strbuf_reset(&pp->children[i].err);
} else {
- fputs(pp->children[i].err.buf, stderr);
+ strbuf_write(&pp->children[i].err, stderr);
strbuf_reset(&pp->children[i].err);
/* Output all other finished child processes */
- fputs(pp->buffered_output.buf, stderr);
+ strbuf_write(&pp->buffered_output, stderr);
strbuf_reset(&pp->buffered_output);
/*