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