run: allow setting output format

This is useful when moving from `--pty` or `--pipe` to using
`--verbose`: you can use `--verbose-output=cat` to get similar output on
stdout while still having all of the advantages of `--verbose` over the
other options.
This commit is contained in:
Arnout Engelen
2026-04-13 13:38:04 +02:00
committed by Lennart Poettering
parent 2c664b9531
commit 086707ba79
5 changed files with 33 additions and 4 deletions
+5 -1
View File
@@ -205,7 +205,7 @@ void fork_notify_terminate_many(sd_event_source **array, size_t n) {
free(array);
}
int journal_fork(RuntimeScope scope, char * const* units, PidRef *ret_pidref) {
int journal_fork(RuntimeScope scope, char * const* units, OutputMode output, PidRef *ret_pidref) {
assert(scope >= 0);
assert(scope < _RUNTIME_SCOPE_MAX);
@@ -228,5 +228,9 @@ int journal_fork(RuntimeScope scope, char * const* units, PidRef *ret_pidref) {
*u) < 0)
return log_oom_debug();
if (output >= 0)
if (strv_extendf(&argv, "--output=%s", output_mode_to_string(output)) < 0)
return log_oom_debug();
return fork_notify(argv, ret_pidref);
}