Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't panic if a write doesn't fully complete #170

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

thenickdude
Copy link

On my Raspberry Pi 3B+, after about 5-10 mins of piping different files to the speaker, I get an error like:

Error: write() failed: 3192

But it's perfectly reasonable for a write() to write fewer bytes than requested (e.g. if the audio device's buffer fills up), so this PR fixes the code so it doesn't panic in this situation and just retries the write of the remaining bytes.

Now my Pi plays flawlessly.

@thenickdude thenickdude force-pushed the support-incomplete-writes branch from 36b5513 to 5c421e8 Compare February 28, 2022 21:22
@Leone25
Copy link

Leone25 commented Feb 3, 2025

I'd like to add to this because I'm having similar issues. I've tried the modified branch and it doesn't seem to fix the issue for me, is still get the following error

Error: write() failed: 0

I'm confused as to why it is needed to error. As a quick test I've modified the following

207c207
< done(new Error(`write() failed: ${r}`))
> done()

and now my code works just fine without crashing the whole app, can't we just ignore length 0 or prevent it from getting to line 207 elsewhere?

thx,
Rico

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants