run: honor --no-block for trigger units

Reproducer:
  unit=run-nb-trigger-$(date +%s)
  systemd-run --no-block --collect --unit="$unit" \
      --socket-property=ListenStream=/proc/systemd-run-repro/socket \
      /usr/bin/true
  echo $?

Before, systemd-run still waited for the trigger unit job and
propagated the socket start failure. With --no-block it should only
verify and enqueue the request, as the service path already does.

Follow-up for 3d161f991e
This commit is contained in:
dongshengyuan
2026-07-14 12:03:22 +08:00
parent 4e67935b77
commit d8f86dff81
2 changed files with 18 additions and 7 deletions
+7
View File
@@ -205,6 +205,13 @@ grep -q "^SocketMode=0644$" "/run/systemd/transient/$UNIT.socket"
grep -qE "^ExecStart=.*true.*$" "/run/systemd/transient/$UNIT.service"
systemctl stop "$UNIT.socket" "$UNIT.service" || :
UNIT="socket-no-block-$RANDOM"
systemd-run --no-block --collect \
--unit="$UNIT" \
--socket-property=ListenStream=/proc/systemd-run-repro/socket \
true
systemctl stop "$UNIT.socket" "$UNIT.service" || :
: "Job mode"
systemd-run --job-mode=help
(! systemd-run --job-mode=foo --scope true)