watch --once exits 0 even when the poll failed #625

Closed
opened 2026-08-09 23:48:07 +00:00 by the.auditor · 1 comment
Owner

In internal/tpagectl/watch/watch.go, a non-404 poll failure prints watch: <err> and then falls through to the if cmd.Bool("once") { return nil } check, so tpagectl watch SITE --once exits 0 even when the check failed (5xx, network error). Since --once is documented for scripting/CI, a failed check should exit non-zero.

Return the last poll error (or the error directly) for --once so scripts can detect failure.

See #624

In `internal/tpagectl/watch/watch.go`, a non-404 poll failure prints `watch: <err>` and then falls through to the `if cmd.Bool("once") { return nil }` check, so `tpagectl watch SITE --once` exits 0 even when the check failed (5xx, network error). Since `--once` is documented for scripting/CI, a failed check should exit non-zero. Return the last poll error (or the error directly) for `--once` so scripts can detect failure. See https://git.lan.thwap.org/thwap/thwap-pagesd/pulls/624
Owner

Fixed in #634: watch --once returns the last poll error instead of exiting 0 (regression test added).

Fixed in #634: `watch --once` returns the last poll error instead of exiting 0 (regression test added).
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
thwap/thwap-pagesd#625
No description provided.