diff options
author | Tulir Asokan <tulir@maunium.net> | 2018-04-24 16:51:40 +0300 |
---|---|---|
committer | Tulir Asokan <tulir@maunium.net> | 2018-04-24 16:51:40 +0300 |
commit | e64df67ec397795b8c6ebd06b391d953afe5a766 (patch) | |
tree | 52cbb9d3d02ec1e89d0de09a05d343408c7d4aba /gomuks.go | |
parent | fcd9a932cb5542ed8980fc1daba7ee1f0041a3f2 (diff) |
Everything is no longer broken
Diffstat (limited to 'gomuks.go')
-rw-r--r-- | gomuks.go | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -18,7 +18,9 @@ package main import ( "os" + "os/signal" "path/filepath" + "syscall" "time" "maunium.net/go/gomuks/config" @@ -104,6 +106,13 @@ func (gmx *Gomuks) Stop() { func (gmx *Gomuks) Start() { _ = gmx.matrix.InitClient() + c := make(chan os.Signal, 1) + signal.Notify(c, os.Interrupt, syscall.SIGTERM) + go func() { + <-c + gmx.Stop() + }() + go gmx.StartAutosave() if err := gmx.ui.Start(); err != nil { panic(err) |