summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormatthieu <matthieu.cneude@gmail.com>2020-05-27 10:48:59 +0200
committermatthieu <matthieu.cneude@gmail.com>2020-05-27 10:48:59 +0200
commit5460ea89f2df86a0e4c86a2c523c0db09c879617 (patch)
treea001a035f22a4d769f3e00dd8db4452176e52ce1
parent245fbaaa5d668e3fd2a90c7895be081380fb05f6 (diff)
More bug fix and cleaning
-rw-r--r--cmd/devdash.go7
-rw-r--r--internal/platform/termui.go4
2 files changed, 6 insertions, 5 deletions
diff --git a/cmd/devdash.go b/cmd/devdash.go
index e203316..03169ee 100644
--- a/cmd/devdash.go
+++ b/cmd/devdash.go
@@ -27,12 +27,11 @@ func begin(file string, debug bool) {
ticker := time.NewTicker(time.Duration(cfg.RefreshTime()) * time.Second)
- go func(c <-chan time.Time) {
+ go func() {
for {
- val := <-c
- hotReload <- val
+ hotReload <- <-ticker.C
}
- }(ticker.C)
+ }()
go func() {
for {
diff --git a/internal/platform/termui.go b/internal/platform/termui.go
index b80d403..2bafeab 100644
--- a/internal/platform/termui.go
+++ b/internal/platform/termui.go
@@ -191,7 +191,9 @@ func (*termUI) KQuit(key string) {
func (t *termUI) KHotReload(key string, c chan<- time.Time) {
termui.Handle(fmt.Sprintf("/sys/kbd/%s", key), func(termui.Event) {
- c <- time.Now()
+ go func() {
+ c <- time.Now()
+ }()
})
}