mirror of
https://github.com/buger/goreplay.git
synced 2024-04-21 12:32:02 +00:00
Do not quite on flush error
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"runtime/debug"
|
||||||
"sort"
|
"sort"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
@@ -208,6 +209,13 @@ func (o *FileOutput) Write(data []byte) (n int, err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (o *FileOutput) flush() {
|
func (o *FileOutput) flush() {
|
||||||
|
// Don't exit on panic
|
||||||
|
defer func() {
|
||||||
|
if r := recover(); r != nil {
|
||||||
|
log.Println("PANIC while file flush: ", r, o, string(debug.Stack()))
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
defer o.mu.Unlock()
|
defer o.mu.Unlock()
|
||||||
o.mu.Lock()
|
o.mu.Lock()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user