diff --git a/src/cli/completion-runtime.ts b/src/cli/completion-runtime.ts index 408eaffa478..b360b2d7659 100644 --- a/src/cli/completion-runtime.ts +++ b/src/cli/completion-runtime.ts @@ -69,9 +69,9 @@ function formatCompletionSourceLine( cachePath: string, ): string { if (shell === "fish") { - return `source "${cachePath}"`; + return `test -f "${cachePath}"; and source "${cachePath}"`; } - return `source "${cachePath}"`; + return `[ -f "${cachePath}" ] && source "${cachePath}"`; } function isCompletionProfileHeader(line: string): boolean {