summaryrefslogtreecommitdiff
path: root/pkg/systray/run.go
diff options
context:
space:
mode:
authorRuben Pollan <meskio@sindominio.net>2019-06-13 12:15:08 +0200
committerRuben Pollan <meskio@sindominio.net>2019-06-13 12:15:08 +0200
commita9ab5e74832545b7914fbbda45b97db10c8e9265 (patch)
treecc4a07087f59d998643f3f4a930f40d35a4c6b76 /pkg/systray/run.go
parent56d79a60679ba3783dcb5dd1ebe69436c5e5af7c (diff)
[bug] wait for tear down
Before finishing the main thread let's wait for the finish of the bitmask/pid/... tear down. So the firewall gets down when you ctrl-c. - Resolves: #142
Diffstat (limited to 'pkg/systray/run.go')
-rw-r--r--pkg/systray/run.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/pkg/systray/run.go b/pkg/systray/run.go
index d9d39de..ce4a886 100644
--- a/pkg/systray/run.go
+++ b/pkg/systray/run.go
@@ -25,11 +25,14 @@ import (
func Run(conf *Config) {
bt := bmTray{conf: conf, waitCh: make(chan bool)}
- go initialize(conf, &bt)
+ finishedCh := make(chan bool)
+ go initialize(conf, &bt, finishedCh)
bt.start()
+ <-finishedCh
}
-func initialize(conf *Config, bt *bmTray) {
+func initialize(conf *Config, bt *bmTray, finishedCh chan bool) {
+ defer func() { finishedCh <- true }()
if _, err := os.Stat(config.Path); os.IsNotExist(err) {
os.MkdirAll(config.Path, os.ModePerm)
}