Commit a9ab5e74 authored by meskio's avatar meskio

[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
parent 56d79a60
......@@ -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)
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)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment