fix: _jack_is_operational() must check jack_lsp stdout, not exit code
CI / test (push) Has been cancelled

jack_lsp on JACK 1.9.22 always exits 0 even when JACK is dead —
it prints error to stderr but returns success. Check for non-empty
stdout (port names) instead, which only appears when JACK is truly
operational.
This commit is contained in:
2026-06-18 18:04:06 -04:00
parent 9a8c59d19c
commit 32990f9744
+7 -8
View File
@@ -854,20 +854,19 @@ def _jack_is_running() -> bool:
def _jack_is_operational() -> bool:
"""Check if JACK is actually accepting client connections.
Uses ``jack_lsp`` to verify the JACK server is operational beyond
just having a running process. ``jack_lsp`` connects to the JACK
server via shared memory and lists ports — it only succeeds when
JACK has fully initialized the ALSA device and IPC is live.
On JACK 1.9.22 there is no ``/dev/shm/jack_default_0_0`` socket,
so ``jack_lsp`` is the most reliable readiness check.
Uses ``jack_lsp`` and checks stdout is non-empty (port names).
``jack_lsp`` always exits 0 on JACK 1.9.22 even when dead —
only stdout content distinguishes 'JACK running' from
'JACK inaccessible'.
"""
try:
result = subprocess.run(
["jack_lsp"],
capture_output=True, timeout=3,
)
return result.returncode == 0
# jack_lsp exits 0 even when dead on JACK 1.9.22 —
# only non-empty stdout means ports were actually listed
return bool(result.stdout.strip())
except (FileNotFoundError, subprocess.TimeoutExpired):
return False