Prevent infinite loop when using on-quit (#1856)
This commit is contained in:
1 parent
f0dddccb04
commit
68a29c9284
1 file changed
+9
@@ -35,6 +35,7 @@ type app struct {
|
|||||||
menuCompInd int
|
menuCompInd int
|
||||||
selectionOut []string
|
selectionOut []string
|
||||||
watch *watch
|
watch *watch
|
||||||
|
quitting bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func newApp(ui *ui, nav *nav) *app {
|
func newApp(ui *ui, nav *nav) *app {
|
||||||
@@ -66,6 +67,14 @@ func newApp(ui *ui, nav *nav) *app {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (app *app) quit() {
|
func (app *app) quit() {
|
||||||
|
// Using synchronous shell commands for `on-quit` can cause this to be
|
||||||
|
// called again, so a guard variable is introduced here to prevent an
|
||||||
|
// infinite loop.
|
||||||
|
if app.quitting {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
app.quitting = true
|
||||||
|
|
||||||
onQuit(app)
|
onQuit(app)
|
||||||
|
|
||||||
if gOpts.history {
|
if gOpts.history {
|
||||||
|
|||||||
Reference in new issue
Block a user