flush when not buffered

pull/714/merge
Darien Raymond 2017-11-15 23:38:52 +01:00
parent f3ba1dbb8c
commit 743d35c059
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169
1 changed files with 2 additions and 1 deletions

View File

@ -67,13 +67,14 @@ func (w *BufferedWriter) Write(b []byte) (int, error) {
if err != nil {
return totalBytes, err
}
if w.buffer.IsFull() {
if !w.buffered || w.buffer.IsFull() {
if err := w.Flush(); err != nil {
return totalBytes, err
}
}
b = b[nBytes:]
}
return totalBytes, nil
}