run: refuse --pty-late for Type=oneshot services

Such combination makes no sense, as by the time the start job
of the oneshot service finishes the main process has already
exited.

Addresses https://github.com/systemd/systemd/pull/36691#discussion_r1988116881
This commit is contained in:
Mike Yuan
2025-03-17 00:21:46 +01:00
parent 647ff4b65e
commit 2fb10b3cfb

View File

@@ -775,6 +775,10 @@ static int parse_argv(int argc, char *argv[]) {
"--pty/--pty-late/--pipe is not compatible with --no-block.");
}
if (arg_stdio == ARG_STDIO_PTY && arg_pty_late && streq_ptr(arg_service_type, "oneshot"))
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
"--pty-late is not compatible with --service-type=oneshot.");
if (arg_scope && with_trigger)
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
"Path, socket or timer options are not supported in --scope mode.");