run: reject JSON output in scope mode
Reproducer:
sudo systemd-run --scope --json=short /bin/echo hi
Before, systemd-run printed JSON metadata to stdout and then executed
the scope command on the same stdout. The combined stream was not valid
JSON, so reject --json= in scope mode.
Follow-up for fe5a6c47af
This commit is contained in:
@@ -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),
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user