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:
@@ -1,3 +1,3 @@
|
||||
"""JUC500 cross-platform file transfer for Apple Silicon Mac ↔ Windows 11."""
|
||||
|
||||
__version__ = "0.1.0"
|
||||
__version__ = "0.1.1"
|
||||
|
||||
@@ -19,7 +19,7 @@ from .protocol import Session
|
||||
from .usb_link import Juc500Link, list_devices, doctor
|
||||
from .wormhole_kill import kill_wormhole_processes, wormhole_status
|
||||
|
||||
DEFAULT_GUI_PORT = 8765
|
||||
DEFAULT_GUI_PORT = 8766 # 8765는 fileShare 등과 자주 충돌
|
||||
|
||||
|
||||
def _static_root() -> Path:
|
||||
@@ -673,8 +673,14 @@ def run_gui(open_browser: bool = True, port: int | None = None, host: str = "127
|
||||
print(f"Wormhole 자동 종료 건너뜀: {exc}")
|
||||
server = ThreadingHTTPServer((host, listen_port), Handler)
|
||||
url = f"http://{host}:{listen_port}/"
|
||||
print(f"JUC500 GUI: {url}")
|
||||
from . import __version__
|
||||
from .usb_link import Juc500Link
|
||||
|
||||
backend = hasattr(Juc500Link, "_backend_bulk_write")
|
||||
print(f"JUC500 GUI v{__version__} (backend_io={backend}): {url}")
|
||||
print("fileShare와 동일한 듀얼 패널 UI · 케이블 연결 후 「연결」을 누르세요.")
|
||||
if listen_port != preferred:
|
||||
print(f"주의: 기본 포트 {preferred} 사용 중 → {listen_port} 으로 열었습니다. 브라우저 주소를 확인하세요.")
|
||||
if open_browser:
|
||||
threading.Timer(0.4, lambda: webbrowser.open(url)).start()
|
||||
try:
|
||||
|
||||
@@ -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" "$@"
|
||||
|
||||
Reference in New Issue
Block a user