Fix spurious "MPV start timed out" on Windows (named-pipe readiness check)#23
Open
cognis-digital wants to merge 1 commit into
Open
Fix spurious "MPV start timed out" on Windows (named-pipe readiness check)#23cognis-digital wants to merge 1 commit into
cognis-digital wants to merge 1 commit into
Conversation
MPVProcess polled os.path.exists(ipc_socket) to detect the IPC endpoint before returning. On Windows the endpoint is a named pipe, and os.path.exists() is always False for \.\pipe\ paths, so the 10s poll never detected the pipe and startup raised 'MPV start timed out' even though MPV was running and the pipe was live. Probe the pipe with _winapi.WaitNamedPipe on Windows (the transport layer already uses _winapi); POSIX behavior is unchanged (still os.path.exists).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On Windows,
MPV(start_mpv=True, ...)reliably fails withMPVError: MPV start timed outeven when MPV launches correctly and the IPC pipe is live.Root cause
MPVProcess.__init__polls for the IPC endpoint with:os.path.exists()is always False for Windows named-pipe paths (\.\pipe\...) —os.statcan't stat a pipe — so the loop never detects the pipe and theelsebranch raisesMPV start timed out, despite MPV being up. POSIX is unaffected because there the endpoint really is a filesystem socket.Fix
Add
_ipc_endpoint_ready(): keepos.path.existson POSIX, but on Windows probe the pipe with_winapi.WaitNamedPipe(the transport layer already depends on_winapi). Minimal, stdlib-only, no new deps, no API change.Verification
Against MPV v0.41 on Windows 10 / Python 3.14:
MPVError: MPV start timed out(every run)MPVconnects in ~0.5s;idle_activeand subsequent commands work.