]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
run: refuse --pty-late for Type=oneshot services 36765/head
authorMike Yuan <me@yhndnzj.com>
Sun, 16 Mar 2025 23:21:46 +0000 (00:21 +0100)
committerMike Yuan <me@yhndnzj.com>
Mon, 17 Mar 2025 00:37:29 +0000 (01:37 +0100)
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

src/run/run.c

index 182925aff0bb8796f1ac5686806b1ec3a398dc46..523993cffdbf5b56624565cc05e907e2efc87b96 100644 (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.");