tmuxclihook 0.5.12 → 0.5.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -959,13 +959,17 @@ _cleanup_stale_panes() {
|
|
|
959
959
|
# (tr -c 'A-Za-z0-9._-' '_'),无法从 key 反推 client → 反向枚举存活集比对。
|
|
960
960
|
# 实测关注:长期运行的 server 会累积已 detach 的 client 键(8 option / 4 存活)。
|
|
961
961
|
_prune_prev_sess_options() {
|
|
962
|
-
local alive=" " name key opt
|
|
962
|
+
local alive=" " name key opt clients opts
|
|
963
|
+
# 两次 tmux 查询都必须成功才剪枝:tmux 抖动(server 重启/连接失败)时
|
|
964
|
+
# list-clients 返回空会被误判为「无存活 client」→ 把全部键删光。
|
|
965
|
+
clients=$(tmux list-clients -F '#{client_name}' 2>/dev/null) || return 0
|
|
966
|
+
opts=$(tmux show-options -g 2>/dev/null) || return 0
|
|
963
967
|
while IFS= read -r name; do
|
|
964
968
|
[ -n "$name" ] || continue
|
|
965
969
|
key=$(printf '%s' "$name" | tr -c 'A-Za-z0-9._-' '_')
|
|
966
970
|
alive="$alive$key "
|
|
967
|
-
done
|
|
968
|
-
for opt in $(
|
|
971
|
+
done <<< "$clients"
|
|
972
|
+
for opt in $(printf '%s\n' "$opts" | awk '/^@ai_prev_sess_/{print $1}'); do
|
|
969
973
|
key="${opt#@ai_prev_sess_}"
|
|
970
974
|
case "$alive" in
|
|
971
975
|
*" $key "*) ;;
|