aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorHarvey Tindall <hrfee@protonmail.ch>2021-05-24 14:51:21 +0100
committerHarvey Tindall <hrfee@protonmail.ch>2021-05-24 14:51:21 +0100
commit8340ef1f20f522095e58332fa0724ef049f73ba8 (patch)
treec9d1f5c3b4d539ea53c85fb45e831bf80dc8dc7d /main.go
parentfe851278f4e08c8c7bda8344f0a9790a35487554 (diff)
downloadwaybar-mpris-8340ef1f20f522095e58332fa0724ef049f73ba8.tar.gz
waybar-mpris-8340ef1f20f522095e58332fa0724ef049f73ba8.zip
always return the expected number of bytes written
emptyEveryWrite was returning the wrong number, so it ignores the real value and just returns the expected value (len(bytes in)). For #4 again.
Diffstat (limited to 'main.go')
-rw-r--r--main.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/main.go b/main.go
index 6fa3844..8e7768f 100644
--- a/main.go
+++ b/main.go
@@ -530,7 +530,9 @@ type dataWrite struct {
func (w dataWrite) Write(p []byte) (n int, err error) {
line := toData(&player{w.Players.mpris2.List[w.Players.mpris2.Current], true})
- return w.emptyEveryWrite.Write([]byte(line))
+ _, err = w.emptyEveryWrite.Write([]byte(line))
+ n = len(p)
+ return
}
type emptyEveryWrite struct {
@@ -542,7 +544,9 @@ func (w emptyEveryWrite) Write(p []byte) (n int, err error) {
if err != nil {
return 0, err
}
- return w.file.WriteAt(p, offset)
+ _, err = w.file.WriteAt(p, offset)
+ n = len(p)
+ return
}
func main() {