Parcourir la source

Geen fatal als de output file voor profiling niet gemaakt kan worden.

Harry de Boer il y a 10 ans
Parent
commit
97ac9312ad
2 fichiers modifiés avec 6 ajouts et 4 suppressions
  1. 3 2
      battlecamp-go-boardgenerator/main.go
  2. 3 2
      main.go

+ 3 - 2
battlecamp-go-boardgenerator/main.go

@@ -63,8 +63,9 @@ func initCpuProfiler() {
 	if *cpuprofile != "" {
 		f, err := os.Create(*cpuprofile)
 		if err != nil {
-			log.Fatal(err)
+			log.Printf("ERROR: %v\n", err)
+		} else {
+			pprof.StartCPUProfile(f)
 		}
-		pprof.StartCPUProfile(f)
 	}
 }

+ 3 - 2
main.go

@@ -21,9 +21,10 @@ func main() {
 	if *flag.CpuProfile != "" {
 		f, err := os.Create(*flag.CpuProfile)
 		if err != nil {
-			log.Fatal(err)
+			log.Printf("ERROR: %v\n", err)
+		} else {
+			pprof.StartCPUProfile(f)
 		}
-		pprof.StartCPUProfile(f)
 	}
 
 	gameServer.Serve()