Commit e696f2ac authored by Jacob Vosmaer's avatar Jacob Vosmaer

Make tempfile write errors permanent

parent f0fd9fdb
......@@ -69,15 +69,26 @@ type coupledWriter struct {
tempfile *os.File
tempfileMutex sync.Mutex
writeError error
}
func (w *coupledWriter) Write(data []byte) (int, error) {
if w.writeError != nil {
return 0, w.writeError
}
if w.busyReader.IsBusy() {
return w.tempfileWrite(data)
n, err := w.tempfileWrite(data)
if err != nil {
w.writeError = fmt.Errorf("coupledWriter: %v", err)
}
return n, w.writeError
}
if err := w.Flush(); err != nil {
return 0, err
w.writeError = fmt.Errorf("coupledWriter: %v", err)
return 0, w.writeError
}
return w.Writer.Write(data)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment