test(e2e-ui): print the proxy log when the proxy dies on its own

In E2E_KEEP_ALIVE=1 mode the harness blocks until the proxy pid goes away, then
printed a bare "Proxy exited." and fell straight into cleanup, which rm -f's the
log. The proxy has now exited by itself twice, minutes after a run had finished,
leaving nothing to look at. Both startup failure paths already tail -n 100 the log
before giving up, so this was the one death that stayed silent

Dump the same 100 lines before exiting. A normal Ctrl-C teardown still deletes the
log and prints nothing, which is why INT and TERM now exit instead of running
cleanup and falling back into the wait loop: under the single trap a SIGTERM
deleted the log, resumed the loop, and would then report "tail: no such file",
besides running cleanup twice
This commit is contained in:
Yuneng Jiang 2026-08-10 15:56:31 -07:00
parent 76e6d40a5a
commit 223c937a20
No known key found for this signature in database

View file

@ -89,7 +89,11 @@ cleanup() {
fi
echo "Done."
}
trap cleanup EXIT INT TERM
on_signal() {
exit 130
}
trap cleanup EXIT
trap on_signal INT TERM
# --- Pre-flight checks ---
for cmd in python3 npx uv; do
@ -271,7 +275,8 @@ EOF
while kill -0 "$PROXY_PID" 2>/dev/null; do
sleep 5
done
echo "Proxy exited."
echo "Error: proxy process exited unexpectedly. Proxy output:"
tail -n 100 "$PROXY_LOG"
exit 1
fi