mirror of
https://github.com/go-sylixos/elvish.git
synced 2024-12-05 03:17:50 +08:00
Use a cooldown in face of editor error.
This commit is contained in:
parent
8bdf6751dd
commit
f14106f5eb
11
run/run.go
11
run/run.go
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user