fix(local): 变量名紧贴全角括号导致 unbound variable / 报错消息中断

bash 3.2 在 UTF-8 下把紧跟变量名的全角字符算进标识符,`"$PREVIEW_PORT(office 文档)"`
会被当成 $PREVIEW_PORT(office 这个变量 → set -u 下直接炸,启动器在 preview 那步退出。
四处一律改成 ${VAR} 形式;其中 `$SKILLS_DIR(python3 未安装…` 是原有问题(只在没 python3 时触发)。
This commit is contained in:
2026-11-11 22:17:43 +08:00
parent b3a0d5370c
commit 893fc92f6d
2 changed files with 4 additions and 4 deletions
+3 -3
View File
@@ -1022,7 +1022,7 @@ SKILLS_DIR=$(skills_dir)
[ -n "$SKILLS_DIR" ] || SKILLS_DIR="$ROOT/skills" # 配置里两个键都被删掉时的兼底
if sync_skills "$SKILLS_DIR"; then
if [ "$PY_OK" = 1 ]; then ui_step "技能:$SKILLS_DIR" ok
else ui_step "技能:$SKILLS_DIR(python3 未安装,Python 技能会失败)" warn; fi
else ui_step "技能:${SKILLS_DIR}(python3 未安装,Python 技能会失败)" warn; fi
else
ui_step '技能目录不可用(检查配置里的 skills_root)' warn
fi
@@ -1033,7 +1033,7 @@ TASKS_DIR=$(cfg_get workspace_root)
if PREVIEW_PORT=$(pick_preview_port); then
start_preview
ui_step "预览网关:$HOST_ADDR:$PREVIEW_PORT(office 文档)" ok
ui_step "预览网关:$HOST_ADDR:${PREVIEW_PORT}(office 文档)" ok
else
PREVIEW_PORT=''
warn '找不到空闲的预览端口(3100-3109),office 文档的预览将不可用'
@@ -1088,7 +1088,7 @@ while :; do
[ "$FF_OK" = 1 ] && check_mcp "$MCP_ASR_PORT" asr
# 预览网关挂了不会影响别的功能,但它静默失败时用户只会看到空白预览,所以点名。
if [ -n "${PREVIEW_PORT:-}" ] && ! port_open "$PREVIEW_PORT"; then
warn "预览网关没起来(端口 $PREVIEW_PORT)——日志:local/.runtime/preview.log"
warn "预览网关没起来(端口 ${PREVIEW_PORT})——日志:local/.runtime/preview.log"
fi
if [ "$FIRST_RUN" = 1 ]; then
# 首次安装:停在状态页,给一个按钮让用户自己点(先看完「首次使用」提示再进去)。
+1 -1
View File
@@ -101,5 +101,5 @@ done
if [ "$stopped" = 1 ]; then
say '已停止'
else
say "没有在运行($PORT、MCP 端口 $MCP_PORTS、预览端口 $pv_port 都空闲)"
say "没有在运行(${PORT}、MCP 端口 ${MCP_PORTS}、预览端口 $pv_port 都空闲)"
fi