diff --git a/engine/engine.go b/engine/engine.go index 661a089e..b7c654cf 100644 --- a/engine/engine.go +++ b/engine/engine.go @@ -49,7 +49,7 @@ func GetBusy() bool { } // Cleanly exits the simulation, assuring all output is flushed. -func Close() { +func CleanExit() { if outputdir == "" { return } diff --git a/engine/gofiles.go b/engine/gofiles.go index 7b6c75a2..bda7c8a1 100644 --- a/engine/gofiles.go +++ b/engine/gofiles.go @@ -52,6 +52,6 @@ func InitAndClose() func() { GoServe(*Flag_webui_addr) return func() { - Close() + CleanExit() } } diff --git a/engine/od.go b/engine/od.go index 0ed8b266..336bf300 100644 --- a/engine/od.go +++ b/engine/od.go @@ -4,6 +4,7 @@ package engine import ( "fmt" + "os" "strings" "github.com/MathieuMoalic/amumax/httpfs" @@ -43,7 +44,7 @@ func InitIO(inputfile, od string) { // cursed error check, not sure how to do better if fmt.Sprint(err) == fmt.Sprintf("mkdir %s: file exists", od) { LogErr(fmt.Sprintf("Directory `%s` exists, skipping `%s` because of --skip-exist flag.", od, inputfile)) - Exit() + os.Exit(0) } else { util.FatalErr(err) } diff --git a/engine/run.go b/engine/run.go index 771f138c..7904440e 100644 --- a/engine/run.go +++ b/engine/run.go @@ -153,7 +153,6 @@ func adaptDt(corr float64) { util.AssertMsg(Dt_si > 0, fmt.Sprint("Time step too small: ", Dt_si)) } - // Run the simulation for a number of seconds. func RunWithoutPrecession(seconds float64) { prevPrecess := Precess @@ -256,6 +255,6 @@ func SanityCheck() { } func Exit() { - Close() + CleanExit() os.Exit(0) } diff --git a/engine/util.go b/engine/util.go index fb41808a..55173b0c 100644 --- a/engine/util.go +++ b/engine/util.go @@ -62,7 +62,7 @@ func Vector(x, y, z float64) data.Vector { func Expect(msg string, have, want, maxError float64) { if math.IsNaN(have) || math.IsNaN(want) || math.Abs(have-want) > maxError { LogOut(msg, ":", " have: ", have, " want: ", want, "±", maxError) - Close() + CleanExit() os.Exit(1) } else { LogOut(msg, ":", have, "OK") diff --git a/main.go b/main.go index d0f25d46..dce36fec 100644 --- a/main.go +++ b/main.go @@ -55,7 +55,7 @@ func main() { os.Exit(0) } - defer engine.Close() // flushes pending output, if any + defer engine.CleanExit() // flushes pending output, if any if *flag_vet { vet()