func (tl *Listener) Stop() bool {
	tl.stop <- true
	return <-tl.done
}
Stop will force the fsnotify code to shut down
package manager
import (
	log "github.com/DataDrake/waterlog"
	"github.com/getsolus/ferryd/manifest"
	"github.com/getsolus/ferryd/util"
	"github.com/radu-munteanu/fsnotify"
	"os"
	"path/filepath"
	"strings"
)
type Listener struct {
	base    string
	watcher *fsnotify.Watcher
	manager *Manager
	stop    chan bool
	done    chan bool
}
func NewListener(baseDir string, mgr *Manager) (tl *Listener, err error) {
	tl = &Listener{
		base:    baseDir,
		manager: mgr,
		stop:    make(chan bool),
		done:    make(chan bool),
	}
	if err = util.CreateDir(tl.base); err != nil {
		return
	}
	if tl.watcher, err = fsnotify.NewWatcher(); err != nil {
		return
	}
	err = tl.watcher.Add(tl.base)
	return
}
func (tl *Listener) Start() {
	go func() {
		for {
			select {
			case event := <-tl.watcher.Events:
				if filepath.Dir(event.Name) != tl.base {
					continue
				}
				if event.Op&fsnotify.Update == fsnotify.Update {
					if strings.HasSuffix(event.Name, manifest.Suffix) {
						tl.processManifest(filepath.Base(event.Name))
					}
				}
			case <-tl.stop:
				tl.done <- true
				return
			}
		}
	}()
}