Restart stale GUI and avoid port 8765 clash with fileShare

Old juc500_app processes kept serving pre-fix code; start.sh now
kills them and GUI defaults to port 8766.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
joyharam
2026-07-15 12:20:15 +09:00
parent ff60cee1cc
commit a423db0556
3 changed files with 28 additions and 3 deletions
+19
View File
@@ -27,4 +27,23 @@ if ! "$PY" -c "import usb" 2>/dev/null; then
exit 1
fi
# 이전 GUI 인스턴스 종료 (옛 코드가 포트 8765를 붙잡고 있으면 같은 에러가 반복됨)
if command -v pgrep >/dev/null 2>&1; then
OLD_PIDS="$(pgrep -f "$ROOT/juc500_app.py" || true)"
if [[ -n "${OLD_PIDS}" ]]; then
echo "이전 JUC500 프로세스 종료: ${OLD_PIDS}"
# shellcheck disable=SC2086
kill ${OLD_PIDS} 2>/dev/null || true
sleep 0.4
# shellcheck disable=SC2086
kill -9 ${OLD_PIDS} 2>/dev/null || true
fi
fi
# 캐시된 .pyc 가 헷갈리지 않도록 (경량)
rm -rf "$ROOT/juc500_xfer/__pycache__" 2>/dev/null || true
REV="$("$PY" -c "from juc500_xfer import __version__; from juc500_xfer.usb_link import Juc500Link; print(__version__, 'backend_io=' + str(hasattr(Juc500Link, '_backend_bulk_write')))")"
echo "JUC500 start — ${REV}"
exec "$PY" "$ROOT/juc500_app.py" "$@"