diff --git a/src/run/run.c b/src/run/run.c index e49e918b0f..57f2e66303 100644 --- a/src/run/run.c +++ b/src/run/run.c @@ -705,6 +705,10 @@ static int parse_argv(int argc, char *argv[]) { return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "--no-block is not supported in --scope mode."); + if (arg_scope && sd_json_format_enabled(arg_json_format_flags)) + return log_error_errno(SYNTHETIC_ERRNO(EINVAL), + "--json= is not supported in --scope mode."); + if (arg_stdio != ARG_STDIO_NONE) { if (with_trigger || arg_scope) return log_error_errno(SYNTHETIC_ERRNO(EINVAL), diff --git a/test/units/TEST-74-AUX-UTILS.run.sh b/test/units/TEST-74-AUX-UTILS.run.sh index 0619a8995f..7d7b95687a 100755 --- a/test/units/TEST-74-AUX-UTILS.run.sh +++ b/test/units/TEST-74-AUX-UTILS.run.sh @@ -120,6 +120,7 @@ systemd-run --scope \ --property=RuntimeMaxSec=infinity \ true (! systemd-run --scope --ignore-failure false) +(! systemd-run --scope --json=short true) : "Transient scope (user daemon)" # FIXME: https://github.com/systemd/systemd/issues/27883