Use a cooldown in face of editor error.

This commit is contained in:
Qi Xiao 2016-02-22 14:39:47 +01:00
parent 8bdf6751dd
commit f14106f5eb

View File

@ -146,6 +146,7 @@ func interact(ev *eval.Evaler, st *store.Store) {
return ed.ReadLine(prompt, rprompt)
}
cooldown := time.Second
usingBasic := false
cmdNum := 0
@ -165,12 +166,18 @@ func interact(ev *eval.Evaler, st *store.Store) {
usingBasic = true
} else {
fmt.Println("Don't know what to do, pid is", os.Getpid())
fmt.Println("Restarting editor in 1s")
time.Sleep(time.Second)
fmt.Println("Restarting editor in", cooldown)
time.Sleep(cooldown)
if cooldown < time.Minute {
cooldown *= 2
}
}
continue
}
// No error; reset cooldown.
cooldown = time.Second
n, err := parse.Parse(lr.Line)
printError(err)