From 862e729f0760aa0d4dc7c2b3df063393e15aff76 Mon Sep 17 00:00:00 2001 From: Joel Rosdahl Date: Sun, 9 May 2010 22:51:16 +0200 Subject: [PATCH] Log executed commands --- ccache.c | 1 + ccache.h | 1 + execute.c | 1 + util.c | 7 +++++++ 4 files changed, 10 insertions(+) diff --git a/ccache.c b/ccache.c index 2fc0658e3..a4f0c3e8d 100644 --- a/ccache.c +++ b/ccache.c @@ -248,6 +248,7 @@ static void failed(void) } cc_log("Failed; falling back to running the real compiler"); + cc_log_executed_command(orig_args->argv); if (getenv("CCACHE_VERBOSE")) { print_executed_command(stdout, orig_args->argv); } diff --git a/ccache.h b/ccache.h index a3072dfec..7d50b2dd2 100644 --- a/ccache.h +++ b/ccache.h @@ -67,6 +67,7 @@ void hash_buffer(struct mdfour *md, const void *s, size_t len); void cc_log_no_newline(const char *format, ...) ATTR_FORMAT(printf, 1, 2); void cc_log(const char *format, ...) ATTR_FORMAT(printf, 1, 2); +void cc_log_executed_command(char **argv); void fatal(const char *format, ...) ATTR_FORMAT(printf, 1, 2); void copy_fd(int fd_in, int fd_out); diff --git a/execute.c b/execute.c index d20f2c922..7eee995a9 100644 --- a/execute.c +++ b/execute.c @@ -45,6 +45,7 @@ int execute(char **argv, if (pid == 0) { int fd; + cc_log_executed_command(argv); if (getenv("CCACHE_VERBOSE")) { print_executed_command(stdout, argv); } diff --git a/util.c b/util.c index 9f90efd9f..a53e2df2f 100644 --- a/util.c +++ b/util.c @@ -80,6 +80,13 @@ void cc_log(const char *format, ...) fflush(logfile); } +void cc_log_executed_command(char **argv) +{ + cc_log_no_newline("Executing "); + print_command(logfile, argv); + fflush(logfile); +} + /* something went badly wrong! */ void fatal(const char *format, ...) { -- 2.47.2