cmd/derpprobe: exit with non-zero status if --once fails

`cmd/derpprobe --once` didn’t respect the convention of non-zero exit
status for a failed run. It would always exit zero (i.e. success),
even. This patch fixes that, but only for `--once` mode.

Fixes: #15925

Signed-off-by: Simon Law <sfllaw@tailscale.com>
This commit is contained in:
Simon Law 2025-05-08 19:37:24 -07:00
parent cb6fc37d66
commit c4f7ef6323
No known key found for this signature in database
GPG Key ID: B83D1EE07548341D

View File

@ -9,6 +9,7 @@ import (
"fmt"
"log"
"net/http"
"os"
"sort"
"time"
@ -75,6 +76,9 @@ func main() {
for _, s := range st.bad {
log.Printf("bad: %s", s)
}
if len(st.bad) > 0 {
os.Exit(1)
}
return
}