serial_unix.go: Keep writing until complete#192
Open
ccollins476ad wants to merge 1 commit intobugst:masterfrom
Open
serial_unix.go: Keep writing until complete#192ccollins476ad wants to merge 1 commit intobugst:masterfrom
ccollins476ad wants to merge 1 commit intobugst:masterfrom
Conversation
Open
4 tasks
725024d to
d5a5a6a
Compare
Fixes bugst#191. Change unix port.Write() implementation to match io.Writer requirement: > Write must return a non-nil error if it returns n < len(p) Keep executing write syscall until failure or entire buffer is written.
d5a5a6a to
0d5660d
Compare
|
I seem to be experiencing this same issue on a specific piece of hardware / uart. Write reports 5 bytes, and only wrote 2 bytes. Obviously this is very frustrating and should be fixed. I will test this PR |
cmaglie
requested changes
Mar 13, 2025
Comment on lines
+115
to
+117
| if err == nil { | ||
| err = fmt.Errorf("unix.Write() returned n<0,err==nil: n=%d", n) | ||
| } |
Member
There was a problem hiding this comment.
Is this needed? It could happen n<0 and err==nil at the same time?
Comment on lines
+125
to
+127
| var n2 int | ||
| n2, err = port.writeOnce(p[n:]) | ||
| n += n2 |
Member
There was a problem hiding this comment.
Why two functions? It couldn't be inlined?
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.
Fixes #191.
Change unix port.Write() implementation to match io.Writer requirement:
Keep executing write syscall until failure or entire buffer is written.