add 'autoquit' option to auto quit server on quit

cc #177
This commit is contained in:
Gokcehan committed 2021-05-19 21:55:19 +03:00
1 parent 7bf895e301
commit 06a30eda19
7 files changed
+35 -2

No files matched your search

+7 -2
View File
@@ -59,11 +59,16 @@ func newApp(ui *ui, nav *nav) *app {
}
func (app *app) quit() {
if err := app.writeHistory(); err != nil {
log.Printf("writing history file: %s", err)
}
if err := remote(fmt.Sprintf("drop %d", gClientID)); err != nil {
log.Printf("dropping connection: %s", err)
}
if err := app.writeHistory(); err != nil {
log.Printf("writing history file: %s", err)
if gOpts.autoquit {
if err := remote("quit"); err != nil {
log.Printf("auto quitting server: %s", err)
}
}
os.Remove(gLogPath)
}