summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2018-01-18 16:45:09 +0700
committerJunio C Hamano <gitster@pobox.com>2018-01-19 10:49:20 -0800
commite73dd78699c4a0a84960c3519e6bdc6e49009740 (patch)
treeff094e51844ca4cdc11421284b7235d9d37d5c4e
parent33011e769c2dd3eaa63e5b480e5845c5d370ab13 (diff)
downloadgit-e73dd78699c4a0a84960c3519e6bdc6e49009740.tar.gz
run-command.c: introduce trace_run_command()
This is the same as the old code that uses trace_argv_printf() in run-command.c. This function will be improved in later patches to print more information from struct child_process. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--run-command.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/run-command.c b/run-command.c
index 31fc5ea86e..eadba8cb0d 100644
--- a/run-command.c
+++ b/run-command.c
@@ -6,6 +6,7 @@
#include "thread-utils.h"
#include "strbuf.h"
#include "string-list.h"
+#include "quote.h"
void child_process_init(struct child_process *child)
{
@@ -556,6 +557,20 @@ static int wait_or_whine(pid_t pid, const char *argv0, int in_signal)
return code;
}
+static void trace_run_command(const struct child_process *cp)
+{
+ struct strbuf buf = STRBUF_INIT;
+
+ if (!trace_want(&trace_default_key))
+ return;
+
+ strbuf_addf(&buf, "trace: run_command:");
+ sq_quote_argv_pretty(&buf, cp->argv);
+
+ trace_printf("%s", buf.buf);
+ strbuf_release(&buf);
+}
+
int start_command(struct child_process *cmd)
{
int need_in, need_out, need_err;
@@ -624,7 +639,8 @@ fail_pipe:
cmd->err = fderr[0];
}
- trace_argv_printf(cmd->argv, "trace: run_command:");
+ trace_run_command(cmd);
+
fflush(NULL);
#ifndef GIT_WINDOWS_NATIVE