vsh: cmdComplete: Don't exit when connecting to the daemon fails

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 <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa
2026-05-05 07:32:11 +02:00
parent 9899c91515
commit 9ba73e7f6f
+5 -2
View File
@@ -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);