fix: _jack_is_operational() must check jack_lsp stdout, not exit code
CI / test (push) Has been cancelled
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:
+7
-8
@@ -854,20 +854,19 @@ def _jack_is_running() -> bool:
|
|||||||
def _jack_is_operational() -> bool:
|
def _jack_is_operational() -> bool:
|
||||||
"""Check if JACK is actually accepting client connections.
|
"""Check if JACK is actually accepting client connections.
|
||||||
|
|
||||||
Uses ``jack_lsp`` to verify the JACK server is operational beyond
|
Uses ``jack_lsp`` and checks stdout is non-empty (port names).
|
||||||
just having a running process. ``jack_lsp`` connects to the JACK
|
``jack_lsp`` always exits 0 on JACK 1.9.22 even when dead —
|
||||||
server via shared memory and lists ports — it only succeeds when
|
only stdout content distinguishes 'JACK running' from
|
||||||
JACK has fully initialized the ALSA device and IPC is live.
|
'JACK inaccessible'.
|
||||||
|
|
||||||
On JACK 1.9.22 there is no ``/dev/shm/jack_default_0_0`` socket,
|
|
||||||
so ``jack_lsp`` is the most reliable readiness check.
|
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
result = subprocess.run(
|
result = subprocess.run(
|
||||||
["jack_lsp"],
|
["jack_lsp"],
|
||||||
capture_output=True, timeout=3,
|
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):
|
except (FileNotFoundError, subprocess.TimeoutExpired):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user