Skip to content

Commit e73dd78

Browse files
pcloudsgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 33011e7 commit e73dd78

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

run-command.c

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include "thread-utils.h"
77
#include "strbuf.h"
88
#include "string-list.h"
9+
#include "quote.h"
910

1011
void child_process_init(struct child_process *child)
1112
{
@@ -556,6 +557,20 @@ static int wait_or_whine(pid_t pid, const char *argv0, int in_signal)
556557
return code;
557558
}
558559

560+
static void trace_run_command(const struct child_process *cp)
561+
{
562+
struct strbuf buf = STRBUF_INIT;
563+
564+
if (!trace_want(&trace_default_key))
565+
return;
566+
567+
strbuf_addf(&buf, "trace: run_command:");
568+
sq_quote_argv_pretty(&buf, cp->argv);
569+
570+
trace_printf("%s", buf.buf);
571+
strbuf_release(&buf);
572+
}
573+
559574
int start_command(struct child_process *cmd)
560575
{
561576
int need_in, need_out, need_err;
@@ -624,7 +639,8 @@ int start_command(struct child_process *cmd)
624639
cmd->err = fderr[0];
625640
}
626641

627-
trace_argv_printf(cmd->argv, "trace: run_command:");
642+
trace_run_command(cmd);
643+
628644
fflush(NULL);
629645

630646
#ifndef GIT_WINDOWS_NATIVE

0 commit comments

Comments
 (0)