summaryrefslogtreecommitdiffhomepage
path: root/cmd
diff options
context:
space:
mode:
authoradamdottv <[email protected]>2025-05-05 14:23:29 -0500
committeradamdottv <[email protected]>2025-05-05 14:23:29 -0500
commit3cc08494a56b30bab8663935eb158906a68bed20 (patch)
tree5296f2ef113cf98f44be315330e4527f3775595c /cmd
parentafcdabd09534fd97c09b128b4b62baa318b92f19 (diff)
downloadopencode-3cc08494a56b30bab8663935eb158906a68bed20.tar.gz
opencode-3cc08494a56b30bab8663935eb158906a68bed20.zip
fix: pubsub leak and shutdown seq
Diffstat (limited to 'cmd')
-rw-r--r--cmd/root.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/cmd/root.go b/cmd/root.go
index f288c9f69..f2c42833a 100644
--- a/cmd/root.go
+++ b/cmd/root.go
@@ -123,12 +123,12 @@ to assist developers in writing, debugging, and understanding code directly from
// Cleanup function for when the program exits
cleanup := func() {
- // Shutdown the app
- app.Shutdown()
-
// Cancel subscriptions first
cancelSubs()
+ // Then shutdown the app
+ app.Shutdown()
+
// Then cancel TUI message handler
tuiCancel()
@@ -188,6 +188,10 @@ func setupSubscriber[T any](
defer logging.RecoverPanic(fmt.Sprintf("subscription-%s", name), nil)
subCh := subscriber(ctx)
+ if subCh == nil {
+ logging.Warn("subscription channel is nil", "name", name)
+ return
+ }
for {
select {