ac834e38
fix: e2e cleanup trap survives a failure before the first daemon starts
a73x 2026-08-09 11:58
Commit message
test/e2e.sh
| Old | New | ||
|---|---|---|---|
| @@ -79,7 +79,12 @@ proxy_pid() { | |||
| 79 | } | 79 | } |
| 80 | 80 | ||
| 81 | cleanup() { | 81 | cleanup() { |
| 82 | kill "$DPID" 2>/dev/null || true | 82 | # `${DPID:-}` rather than `$DPID`: DPID is the one variable this trap |
| 83 | # reads that is assigned AFTER the trap is installed, and the scenarios | ||
| 84 | # above the first daemon (--version) can fail before it ever is. Under | ||
| 85 | # `set -u` the bare form would abort the trap on an unbound variable, | ||
| 86 | # skipping the rm below — a failing suite would also leave its files. | ||
| 87 | [ -n "${DPID:-}" ] && kill "$DPID" 2>/dev/null || true | ||
| 83 | # `|| true` on every one of these: under `set -e` a kill of an | 88 | # `|| true` on every one of these: under `set -e` a kill of an |
| 84 | # already-dead pid would abort the trap itself, skipping the rm below and | 89 | # already-dead pid would abort the trap itself, skipping the rm below and |
| 85 | # failing a suite that had actually passed. | 90 | # failing a suite that had actually passed. |