From 192910f45a3b095fb0ab82b3d26f5be30801edd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaroslav=20Bene=C5=A1?= Date: Tue, 1 Dec 2026 19:52:50 +0000 Subject: [PATCH] Smoke test: keep the server's own process id, and check that it stops Started through a shell function, the id kept was the subshell's, and the server outlived the test. Co-Authored-By: Claude Fable 5.2 --- llembas/tests/smoke.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/llembas/tests/smoke.sh b/llembas/tests/smoke.sh index 6c0ce8b6b..a0593743b 100755 --- a/llembas/tests/smoke.sh +++ b/llembas/tests/smoke.sh @@ -41,8 +41,12 @@ if [ "$P" = LLEMBAS_TTY ]; then fi # A WezTerm that started us must not be passed on, nor talked to. -clean env WEZTERM_PANE=77 WEZTERM_UNIX_SOCKET="$work/run/not-ours" WEZTERM_CONFIG_FILE="$work/nope.lua" \ - "$MUX" > "$work/server.txt" 2>&1 & +# (exec, so that the process id we keep is the server's own and stopping it stops the server) +( + exec env -i PATH=/usr/bin:/bin HOME="$work/home" XDG_RUNTIME_DIR="$work/run" XDG_CONFIG_HOME="$work/cfg" \ + WEZTERM_PANE=77 WEZTERM_UNIX_SOCKET="$work/run/not-ours" WEZTERM_CONFIG_FILE="$work/nope.lua" \ + "$MUX" +) > "$work/server.txt" 2>&1 & pid=$! sock="$work/run/$APPDIR/sock" for _ in $(seq 40); do @@ -73,7 +77,9 @@ sleep 0.5 expect "send-text --no-paste arrives, get-text reads it" "$(cli get-text --pane-id "$pane")" 'typed by the cli' expect "cli list shows the pane" "$(cli list)" "(^|[^0-9])$pane([^0-9]|$)" -kill "$pid" 2>/dev/null; wait "$pid" 2>/dev/null; pid="" +kill "$pid" 2>/dev/null; wait "$pid" 2>/dev/null +if kill -0 "$pid" 2>/dev/null; then bad "the server did not stop"; else ok "the server stops when told"; fi +pid="" if [ "$P" = LLEMBAS_TTY ]; then # The built-in configuration applied the layer: its keys are bound. And a person's own file