From: Zbigniew Jędrzejewski-Szmek Date: Wed, 27 Sep 2023 07:55:57 +0000 (+0200) Subject: exec-util: print executed commands in do_execute() X-Git-Tag: v255-rc1~394^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F29361%2Fhead;p=thirdparty%2Fsystemd.git exec-util: print executed commands in do_execute() kernel-install uses do_execute(). We would log whenever a spawned child finished, but we would not log anything when the child is launched. When the children log output without a prefix (as the kernel-install plugins do), it is hard to see where that output is coming from. --- diff --git a/src/shared/exec-util.c b/src/shared/exec-util.c index 735334719ba..5da613bc17c 100644 --- a/src/shared/exec-util.c +++ b/src/shared/exec-util.c @@ -12,6 +12,7 @@ #include "env-file.h" #include "env-util.h" #include "errno-util.h" +#include "escape.h" #include "exec-util.h" #include "fd-util.h" #include "fileio.h" @@ -138,6 +139,14 @@ static int do_execute( return log_error_errno(fd, "Failed to open serialization file: %m"); } + if (DEBUG_LOGGING) { + _cleanup_free_ char *args = NULL; + if (argv) + args = quote_command_line(strv_skip(argv, 1), SHELL_ESCAPE_EMPTY); + + log_debug("About to execute %s%s%s", t, argv ? " " : "", argv ? strnull(args) : ""); + } + r = do_spawn(t, argv, fd, &pid, FLAGS_SET(flags, EXEC_DIR_SET_SYSTEMD_EXEC_PID)); if (r <= 0) continue;