From 8c3da35f3efe99b9d9bae39705cabeb864bc96d6 Mon Sep 17 00:00:00 2001 From: musou1500 Date: Sun, 22 Sep 2024 00:33:04 +0900 Subject: [PATCH] improve performance on WSL2 #96 --- lib/core-complete.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/core-complete.sh b/lib/core-complete.sh index b487541d..f53fd447 100644 --- a/lib/core-complete.sh +++ b/lib/core-complete.sh @@ -2559,7 +2559,7 @@ function ble/complete/source:command/.print-command { # Note: cygwin では cyg,x86,i68 等で始まる場合にとても遅い。他の環境でも空 # の補完を実行すると遅くなる可能性がある。 local slow_compgen= - if [[ ! $COMPV ]]; then + if [[ ! $COMPV ]] || [[ -f /proc/sys/fs/binfmt_misc/WSLInterop ]]; then slow_compgen=1 elif [[ $OSTYPE == cygwin* ]]; then case $COMPV in @@ -2572,7 +2572,7 @@ function ble/complete/source:command/.print-command { # function はクォート除去が実行される。従って、compgen -A command には直 # 接 COMPV を渡し、compgen -A function には compv_quoted を渡す。 if [[ $slow_compgen ]]; then - shopt -q no_empty_cmd_completion && return 0 + [[ ! $COMPV ]] && shopt -q no_empty_cmd_completion && return 0 ble/util/conditional-sync \ 'builtin compgen -c -- "$COMPV"' \ '! ble/complete/check-cancel' 128 progressive-weight