]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
run: refuse --no-block when combined with --scope
authorShihao Ren <renshihao.rsh@bytedance.com>
Tue, 30 Jun 2026 12:30:50 +0000 (20:30 +0800)
committerLennart Poettering <lennart@poettering.net>
Wed, 1 Jul 2026 21:37:44 +0000 (23:37 +0200)
In the systemd-run --scope mode, --no-block has no actual effect and will
be silently ignored. Therefore, this combination is explicitly rejected to
reduce confusion for users when using it.

Fixes: #42806
man/systemd-run.xml
src/run/run.c

index e66672f716825293e9715ad8c4b93b39a82d9def..386702ac401dc9e69124d85d30fdfad6f49b0ae0 100644 (file)
           <para>Do not synchronously wait for the unit start operation to finish. If this option is not specified, the
           start request for the transient unit will be verified, enqueued and <command>systemd-run</command> will wait
           until the unit's start-up is completed. By passing this argument, it is only verified and enqueued. This
-          option may not be combined with <option>--wait</option>.</para>
+          option may not be combined with <option>--wait</option> or <option>--scope</option>.</para>
 
           <xi:include href="version-info.xml" xpointer="v220"/>
         </listitem>
index 168cd2f4e672c522a9c389ccd38e8a0c7ee51cb9..785ac9e6687524f0394bc100544613a2343aeed3 100644 (file)
@@ -694,6 +694,10 @@ static int parse_argv(int argc, char *argv[]) {
                 return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
                                        "--remain-after-exit and --service-type= are not supported in --scope mode.");
 
+        if (arg_scope && arg_no_block)
+                return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
+                                       "--no-block is not supported in --scope mode.");
+
         if (arg_stdio != ARG_STDIO_NONE) {
                 if (with_trigger || arg_scope)
                         return log_error_errno(SYNTHETIC_ERRNO(EINVAL),