Skip to content

Commit

Permalink
fix: drop workspace after stopping server process (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
vigneshd332 authored Mar 12, 2023
1 parent c9350a6 commit 6abbe8e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions utils/websocket.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,17 @@ func InitWebsocket(c echo.Context) error {
}

func dropConnection(ws *models.WebsocketConnection, c echo.Context) {
err := os.RemoveAll(ws.WorkspacePath)
if err != nil {
c.Echo().Logger.Error(err)
}
err = ws.LSPServer.Process.Process.Signal(os.Interrupt)
err := ws.LSPServer.Process.Process.Signal(os.Interrupt)
if err != nil {
c.Echo().Logger.Error(err)
}
_ = ws.LSPServer.DevNullFd.Close()
// Reads process exit state to remove the <defunct> process from the system process table
_ = ws.LSPServer.Process.Wait()
err = os.RemoveAll(ws.WorkspacePath)
if err != nil {
c.Echo().Logger.Error(err)
}
ws.Connection.Close()
c.Echo().Logger.Info("WS Connection ", ws.ID, " closed")
}
Expand Down

0 comments on commit 6abbe8e

Please sign in to comment.