fix: main loop never closed, disconnect-daemon ran every iteration

The main loop's closing paren was missing — (sleep 0.1)) only closed
sleep and the minibuffer let, but NOT the loop itself. The next form
(progn (disconnect-daemon)) was INSIDE the loop body, called on every
iteration. On first call it added '* Disconnected *' and cleared the
daemon stream, making the TUI permanently disconnected.

Fix: add ) to close the loop. Also:
- Connect-daemon runs synchronously BEFORE with-terminal (3 ports, 6s
  max). If daemon is already running, the TUI starts connected.
- If sync connect fails, background thread retries every 5 seconds.
- start-daemon in background (no blocking wait for daemon startup),
  so TUI appears immediately.
This commit is contained in:
2026-05-15 12:08:40 -04:00
parent bd1e8a92be
commit df33e8d6db
2 changed files with 27 additions and 19 deletions

View File

@@ -378,8 +378,9 @@ case "$COMMAND" in
check_dependencies
export PASSEPARTOUT_DATA_DIR="${PASSEPARTOUT_DATA_DIR:-$SCRIPT_DIR}"
if ! ss -tln 2>/dev/null | grep -q 9105 && ! netstat -tln 2>/dev/null | grep -q 9105; then
echo "Starting daemon first..."
$0 daemon
echo "Starting daemon..."
# Start daemon in background — don't block TUI startup
$0 daemon &>/dev/null &
fi
# Build TUI load script with proper paths
cat > /tmp/tui-load.lisp << LISPEOF