diff --git a/app.go b/app.go index 45e0dbd2..8fd2066f 100644 --- a/app.go +++ b/app.go @@ -35,6 +35,7 @@ type app struct { menuCompInd int selectionOut []string watch *watch + quitting bool } func newApp(ui *ui, nav *nav) *app { @@ -66,6 +67,14 @@ func newApp(ui *ui, nav *nav) *app { } 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) if gOpts.history {