Make sure CPU profile actually gets written before exiting

This commit is contained in:
Jakob Borg 2015-07-20 15:34:40 +02:00
parent 491452a19d
commit d3387e2a28
1 changed files with 5 additions and 1 deletions

View File

@ -672,7 +672,6 @@ func syncthingMain() {
log.Fatal(err)
}
pprof.StartCPUProfile(f)
defer pprof.StopCPUProfile()
}
for _, device := range cfg.Devices() {
@ -728,6 +727,11 @@ func syncthingMain() {
mainSvc.Stop()
l.Okln("Exiting")
if cpuProfile {
pprof.StopCPUProfile()
}
os.Exit(code)
}