cmd/derpprobe: exit with non-zero status if --once fails (#15926)

`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-12 12:53:55 -07:00 committed by GitHub
parent 13e91f4a2f
commit 7f4aaed1d5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

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
}