From: Peter Krempa <[email protected]>

Invoke the 'connHandler' without checking return value. 'virsh complete'
can provide useful completions even when the daemon connection is
broken.

Signed-off-by: Peter Krempa <[email protected]>
---
 tools/vsh.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/tools/vsh.c b/tools/vsh.c
index c84d17a332..ccf2f21d64 100644
--- a/tools/vsh.c
+++ b/tools/vsh.c
@@ -3584,8 +3584,11 @@ cmdComplete(vshControl *ctl, const vshCmd *cmd)
         ctl->stderr_closed = true;
     }

-    if (!(hooks && hooks->connHandler && hooks->connHandler(ctl)))
-        return false;
+    /* Attempt connecting so that we can also do completions based on e.g.
+     * object names work. Failure to connect is not fatal because we want
+     * at least argument completion */
+    if (hooks && hooks->connHandler)
+        ignore_value(hooks->connHandler(ctl));

     vshReadlineInit(ctl);

-- 
2.54.0

Reply via email to