Fix Windows sounds not playing - #1
Open
zarvox32 wants to merge 1 commit into
Open
Conversation
…back winsound.PlaySound with SND_ASYNC starts playback on a background thread and returns immediately, but the Python process then exits — killing the thread before any audio is heard. Fix by spawning a detached child process that plays the sound synchronously within itself, matching the pattern macOS/Linux already use with start_new_session=True. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Bug: No sounds play on Windows
Summary
The plugin was completely non-functional on Windows. No sounds were ever heard despite hooks firing correctly.
Root Cause
In
hooks/play_sound.py,winsound.PlaySoundwas called with theSND_ASYNCflag:SND_ASYNCstarts sound playback on a background thread and returns immediately. Since the script has nothing left to do after this call, the Python process exits — terminating the background thread and killing the sound before any audio is heard.This affected all sound events:
question,complete,error, andpermission.Fix
Spawn a detached Python process that plays the sound synchronously within itself — the same pattern macOS/Linux already use with
start_new_session=True:The parent hook process exits immediately (so the hook timeout is irrelevant), and the detached child plays the sound to completion in the background.
Impact
start_new_session=True)🤖 Generated with Claude Code