diff options
Diffstat (limited to 'internal/lsp/server.go')
| -rw-r--r-- | internal/lsp/server.go | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/internal/lsp/server.go b/internal/lsp/server.go index c266e91..25c5e5c 100644 --- a/internal/lsp/server.go +++ b/internal/lsp/server.go @@ -378,7 +378,13 @@ func (s *Server) Run() error { // A response from client; ignore continue } - go s.handle(req) + // Track every request goroutine so Run's deferred inflight.Wait() + // catches them all and prevents use-after-close writes to s.out. + s.inflight.Add(1) + go func(r Request) { + defer s.inflight.Done() + s.handle(r) + }(req) if s.exited.Load() { return nil } |
