21255d
From 91c83bde0904581fbc33eb7821119e665b9505ce Mon Sep 17 00:00:00 2001
21255d
From: Filipe Brandenburger <filbranden@google.com>
21255d
Date: Fri, 20 Jul 2018 11:32:55 -0700
21255d
Subject: [PATCH] systemctl: Only wait when there's something to wait for.
21255d
21255d
Tested:
21255d
- `systemctl --wait start i-do-not-exist.service` does not wait.
21255d
- `systemctl --wait start i-do-not-exist.service valid-unit.service` does.
21255d
21255d
(cherry picked from commit 46f2579c2ac9f6780d5afec1000764defc6b581e)
21255d
21255d
Related: #846319
21255d
---
21255d
 src/systemctl/systemctl.c | 2 +-
21255d
 1 file changed, 1 insertion(+), 1 deletion(-)
21255d
21255d
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
21255d
index f057dc829c..1929692480 100644
21255d
--- a/src/systemctl/systemctl.c
21255d
+++ b/src/systemctl/systemctl.c
21255d
@@ -3130,7 +3130,7 @@ static int start_unit(int argc, char *argv[], void *userdata) {
21255d
                                 check_triggering_units(bus, *name);
21255d
         }
21255d
 
21255d
-        if (r >= 0 && arg_wait) {
21255d
+        if (r >= 0 && arg_wait && !set_isempty(wait_context.unit_paths)) {
21255d
                 int q;
21255d
                 q = sd_event_loop(wait_context.event);
21255d
                 if (q < 0)