diff --git a/src/run/run.c b/src/run/run.c index 5d95ee8a22..6754b80bcf 100644 --- a/src/run/run.c +++ b/src/run/run.c @@ -723,6 +723,10 @@ static int parse_argv(int argc, char *argv[]) { return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "--pty-late is not compatible with --service-type=oneshot."); + if (sd_json_format_enabled(arg_json_format_flags) && arg_stdio != ARG_STDIO_NONE) + return log_error_errno(SYNTHETIC_ERRNO(EINVAL), + "--json= is not compatible with --pty/--pty-late/--pipe."); + if (arg_scope && with_trigger) return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Path, socket or timer options are not supported in --scope mode."); diff --git a/test/units/TEST-74-AUX-UTILS.run.sh b/test/units/TEST-74-AUX-UTILS.run.sh index acd7bc5b6c..a5c79ddb72 100755 --- a/test/units/TEST-74-AUX-UTILS.run.sh +++ b/test/units/TEST-74-AUX-UTILS.run.sh @@ -256,6 +256,7 @@ systemd-run --wait --pty true systemd-run --wait --machine=.host --pty true systemd-run --json=short true | jq . >/dev/null systemd-run --json=pretty true | jq . >/dev/null +(! systemd-run --wait --pipe --json=short true) (! SHELL=/bin/false systemd-run --quiet --shell) (! systemd-run)