completions/docker: don't load if docker is not started

In WSL, if Docker is not started, the `docker` command is a script
that prints an error message to stdout instead of a valid script.

`docker.exe` is available and can return the completion script. However
any completion will end up calling that `docker` script anyway,
resulting further errors due to the unexpected output.

Closes #12538
This commit is contained in:
Nahor
2026-03-12 11:10:04 -07:00
committed by Johannes Altmanninger
parent ddf99b7063
commit eab84c896e

View File

@@ -1 +1,4 @@
docker completion fish 2>/dev/null | source
# In WSL, when the docker app is not yet started, "docker" is a script printing
# some error message on stdout instead of a sourceable script
set -l docker_completion "$(docker completion fish 2>/dev/null)"
and eval "$docker_completion"