fix: reap orphan Xvfb before integration-ui run

xvfb-run --auto-servernum picks a fresh display number, but if a previous
session left an orphan Xvfb process (e.g. killed mid-flight), the stale
/tmp/.X11-unix/X<N> socket and X<N>-lock still belong to that orphan, and
xvfb-run's cleanup at the end fails with "kill: No such process" — flipping
the script's exit status to non-zero even when the integration test itself
passed. Reap orphan Xvfb processes (pgrep -u $USER -x Xvfb) and remove their
display sockets and lock files before invoking xvfb-run.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Thomas Güttler
2026-04-28 12:42:34 +02:00
co-authored by Claude Opus 4.7
parent 2e2b7c3d9f
commit db05878aca
+14
View File
@@ -41,6 +41,20 @@ command -v xvfb-run >/dev/null || {
exit 1
}
# Reap orphan Xvfb processes from previous sessions that were killed mid-flight.
# Without this, xvfb-run's wrapper may pick a fresh display via --auto-servernum
# but the leftover Xvfb's stale /tmp/.X11-unix/X<N> socket and lock file confuse
# its cleanup, producing "kill: No such process" on exit and a non-zero status
# even when the test itself passed.
for _xvfb_pid in $(pgrep -u "$USER" -x Xvfb 2>/dev/null); do
_xvfb_display=$(tr '\0' ' ' < "/proc/${_xvfb_pid}/cmdline" 2>/dev/null \
| grep -oE ':[0-9]+' | head -1)
kill "$_xvfb_pid" 2>/dev/null || true
[ -n "$_xvfb_display" ] && {
rm -f "/tmp/.X11-unix/X${_xvfb_display#:}" "/tmp/.X${_xvfb_display#:}-lock" 2>/dev/null || true
}
done
ts "script start"
# Pre-seed spam-filter version so Stalwart does not fetch it on first boot.