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.
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user