mirror of
https://github.com/octoleo/syncthing.git
synced 2024-11-09 23:00:58 +00:00
commit
65c906f951
@ -118,11 +118,18 @@ func (p *syncthingProcess) stop() error {
|
||||
|
||||
raceConditionStart := []byte("WARNING: DATA RACE")
|
||||
raceConditionSep := []byte("==================")
|
||||
panicConditionStart := []byte("panic:")
|
||||
panicConditionSep := []byte(p.id.String()[:5])
|
||||
sc := bufio.NewScanner(fd)
|
||||
race := false
|
||||
_panic := false
|
||||
for sc.Scan() {
|
||||
line := sc.Bytes()
|
||||
if race {
|
||||
if race || _panic {
|
||||
if bytes.Contains(line, panicConditionSep) {
|
||||
_panic = false
|
||||
continue
|
||||
}
|
||||
fmt.Printf("%s\n", line)
|
||||
if bytes.Contains(line, raceConditionSep) {
|
||||
race = false
|
||||
@ -134,6 +141,11 @@ func (p *syncthingProcess) stop() error {
|
||||
if err == nil {
|
||||
err = errors.New("Race condition detected")
|
||||
}
|
||||
} else if bytes.Contains(line, panicConditionStart) {
|
||||
_panic = true
|
||||
if err == nil {
|
||||
err = errors.New("Panic detected")
|
||||
}
|
||||
}
|
||||
}
|
||||
return err
|
||||
|
Loading…
Reference in New Issue
Block a user