Fix weather satellite mode returning false success on SatDump startup failure

Add synchronous startup verification after Popen() — sleep 0.5s and poll
the process before returning to the caller. If SatDump exits immediately
(missing device, bad args), raise RuntimeError with the actual error
message instead of returning status: 'started'. Keep a shorter (2s) async
backup check for slower failures.

Also fix --source_id handling: omit the flag entirely when no serial number
is found instead of passing "0" which SatDump may reject. Change start()
and start_from_file() to return (bool, str|None) tuples so error messages
propagate through to the HTTP response.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Smittix
2026-02-25 21:49:16 +00:00
parent a50f77629c
commit 935b7a4d9d
7 changed files with 197 additions and 147 deletions

View File

@@ -546,7 +546,7 @@ class TestWeatherSatScheduler:
mock_decoder = MagicMock()
mock_decoder.is_running = False
mock_decoder.start.return_value = True
mock_decoder.start.return_value = (True, None)
mock_get.return_value = mock_decoder
mock_timer_instance = MagicMock()
@@ -590,7 +590,7 @@ class TestWeatherSatScheduler:
mock_decoder = MagicMock()
mock_decoder.is_running = False
mock_decoder.start.return_value = False
mock_decoder.start.return_value = (False, 'Start failed')
mock_get.return_value = mock_decoder
pass_data = {
@@ -798,7 +798,7 @@ class TestSchedulerIntegration:
mock_decoder = MagicMock()
mock_decoder.is_running = False
mock_decoder.start.return_value = True
mock_decoder.start.return_value = (True, None)
mock_get_decoder.return_value = mock_decoder
scheduler = WeatherSatScheduler()