Skip to content

Commit 63dac5e

Browse files
authored
Merge pull request #146 from arduino/tmp_cleanup
Do proper clean-up of tmp directories
2 parents bdef5c2 + 943d67e commit 63dac5e

File tree

2 files changed

+7
-15
lines changed

2 files changed

+7
-15
lines changed

Diff for: ls/ls.go

+7-14
Original file line numberDiff line numberDiff line change
@@ -977,8 +977,8 @@ func (ls *INOLanguageServer) initializedNotifFromIDE(logger jsonrpc.FunctionLogg
977977

978978
func (ls *INOLanguageServer) exitNotifFromIDE(logger jsonrpc.FunctionLogger) {
979979
ls.Clangd.conn.Exit()
980-
logger.Logf("Arduino Language Server is shutting down.")
981-
os.Exit(0)
980+
logger.Logf("Arduino Language Server is exiting.")
981+
ls.Close()
982982
}
983983

984984
func (ls *INOLanguageServer) textDocumentDidOpenNotifFromIDE(logger jsonrpc.FunctionLogger, ideParam *lsp.DidOpenTextDocumentParams) {
@@ -1381,18 +1381,6 @@ func (ls *INOLanguageServer) Close() {
13811381
close(ls.closing)
13821382
ls.closing = nil
13831383
}
1384-
if ls.buildPath != nil {
1385-
ls.buildPath.RemoveAll()
1386-
}
1387-
}
1388-
1389-
// CloseNotify returns a channel that is closed when the InoHandler is closed
1390-
func (ls *INOLanguageServer) CloseNotify() <-chan bool {
1391-
return ls.closing
1392-
}
1393-
1394-
// CleanUp performs cleanup of the workspace and temp files create by the language server
1395-
func (ls *INOLanguageServer) CleanUp() {
13961384
if ls.buildPath != nil {
13971385
ls.buildPath.RemoveAll()
13981386
ls.buildPath = nil
@@ -1403,6 +1391,11 @@ func (ls *INOLanguageServer) CleanUp() {
14031391
}
14041392
}
14051393

1394+
// CloseNotify returns a channel that is closed when the InoHandler is closed
1395+
func (ls *INOLanguageServer) CloseNotify() <-chan bool {
1396+
return ls.closing
1397+
}
1398+
14061399
func (ls *INOLanguageServer) extractDataFolderFromArduinoCLI(logger jsonrpc.FunctionLogger) (*paths.Path, error) {
14071400
var dataDir string
14081401
if ls.config.CliPath == nil {

Diff for: main.go

-1
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,5 @@ https://microsoft.github.io/language-server-protocol/
155155
case <-c:
156156
log.Println("INTERRUPTED")
157157
}
158-
inoHandler.CleanUp()
159158
inoHandler.Close()
160159
}

0 commit comments

Comments
 (0)