Fix TUI startup and test script bugs

- TUI: replace per-call bufio.Scanner with a goroutine+channel reader
  (lineReader) so a single scanner lives for the connection lifetime;
  previous pattern silently dropped messages due to scanner read-ahead
- test-tui.sh / test-network.sh: add `return 0` to wait_port — when the
  port opens and the while condition becomes false, bash returned the
  condition's exit code (1) to the caller, tripping set -e immediately
- .gitignore: use /tui (root-only) instead of tui to avoid ignoring cmd/tui/

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Fredrik Johansson
2026-06-21 18:46:40 +02:00
parent 714ac15816
commit 5a0bcee8c6
4 changed files with 47 additions and 24 deletions

View File

@@ -17,7 +17,7 @@ RED='\033[0;31m'; GREEN='\033[0;32m'; YELLOW='\033[1;33m'
CYAN='\033[0;36m'; DIM='\033[2m'; BOLD='\033[1m'; RESET='\033[0m'
rm -rf "$DATA_ROOT"
mkdir -p "$DATA_ROOT"
mkdir -p "$DATA_ROOT/bin"
PIDS=()
cleanup() {
@@ -35,6 +35,7 @@ wait_port() {
n=$(( n + 1 ))
[ "$n" -gt 80 ] && { echo "timeout waiting for :$port" >&2; exit 1; }
done
return 0
}
ipc() { echo "$2" | nc -q 0 127.0.0.1 "$1" >/dev/null 2>&1 || true; }