v2.26.7: fix health check SDR detection on macOS (#188)

timeout (GNU coreutils) is not available on macOS, causing rtl_test to
silently fail and report no SDR device found. Now tries timeout, then
gtimeout (Homebrew coreutils), then falls back to background process
with manual kill.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Smittix
2026-03-14 16:01:55 +00:00
parent dc0850d339
commit 05141b9a1b
4 changed files with 28 additions and 3 deletions
+12 -1
View File
@@ -1924,7 +1924,18 @@ do_health_check() {
info "SDR device detection..."
if cmd_exists rtl_test; then
local rtl_output
rtl_output=$(timeout 3 rtl_test -d 0 2>&1 || true)
if cmd_exists timeout; then
rtl_output=$(timeout 3 rtl_test -d 0 2>&1 || true)
elif cmd_exists gtimeout; then
rtl_output=$(gtimeout 3 rtl_test -d 0 2>&1 || true)
else
# No timeout command (common on macOS) — run with background kill
rtl_test -d 0 > /tmp/.rtl_test_out 2>&1 & local rtl_pid=$!
sleep 2
kill "$rtl_pid" 2>/dev/null; wait "$rtl_pid" 2>/dev/null
rtl_output=$(cat /tmp/.rtl_test_out 2>/dev/null || true)
rm -f /tmp/.rtl_test_out
fi
if echo "$rtl_output" | grep -q "Found\|Using device"; then
ok "RTL-SDR device detected"
((pass++)) || true