From 12bdf623116a9a5c2dac06f205d9fbffba6ff207 Mon Sep 17 00:00:00 2001 From: kaidaguerre Date: Thu, 12 May 2022 10:21:55 +0100 Subject: [PATCH] Fix ctrl+c during dashboard execution causing a "panic: send on closed channel". Closes #2048 --- workspace/workspace_events.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/workspace/workspace_events.go b/workspace/workspace_events.go index a53588027..f4d6260a9 100644 --- a/workspace/workspace_events.go +++ b/workspace/workspace_events.go @@ -13,8 +13,10 @@ import ( ) func (w *Workspace) PublishDashboardEvent(e dashboardevents.DashboardEvent) { - // send an event onto the event bus - w.dashboardEventChan <- e + if w.dashboardEventChan != nil { + // send an event onto the event bus + w.dashboardEventChan <- e + } } // RegisterDashboardEventHandler starts the event handler goroutine if necessary and @@ -34,6 +36,7 @@ func (w *Workspace) handleDashboardEvent() { for { e := <-w.dashboardEventChan if e == nil { + w.dashboardEventChan = nil return }