Skip to content

Conversation

cmaglie
Copy link
Member

@cmaglie cmaglie commented Mar 21, 2023

Please check if the PR fulfills these requirements

What kind of change does this PR introduce?

  • Fix the cleanup of temporary files created during language server execution.
  • All temporary files are now created under the same sub-directory of tmp

What is the current behavior?

Language server temp directory:    C:\Users\cmagl\AppData\Local\Temp\system-includes-0f3fe3.clangd
Language server build path:        C:\Users\cmagl\AppData\Local\Temp\arduino-language-server3185134839
Language server build sketch root: C:\Users\cmagl\AppData\Local\Temp\arduino-language-server3185134839\sketch
Language server FULL build path:   C:\Users\cmagl\AppData\Local\Temp\arduino-language-server795682186

What is the new behavior?

  • All temporary files are removed on exit.
  • All temporary files are created under the same subdir of TMP
Language server temp directory:    C:\Users\cmagl\AppData\Local\Temp\arduino-language-server2854144105\system-includes-0f3fe3.clangd
Language server build path:        C:\Users\cmagl\AppData\Local\Temp\arduino-language-server2854144105\build
Language server build sketch root: C:\Users\cmagl\AppData\Local\Temp\arduino-language-server2854144105\build\sketch
Language server FULL build path:   C:\Users\cmagl\AppData\Local\Temp\arduino-language-server2854144105\fullbuild

Other information:
Fix #145


@cmaglie cmaglie self-assigned this Mar 21, 2023
@cmaglie cmaglie added topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project labels Mar 21, 2023
The temp dir cleanup is done on the "exit" notification.
BTW, if the OS/system is too slow, the language server may be killed by the
IDE if it takes too long to clean up temporary build directories.

To avoid it a new detached process is created with the only purpose to
remove the temporary directories. Since it's detached it will run even
after the parent process exits.
@cmaglie cmaglie force-pushed the fix-temp-file-cleanup branch from 2760510 to ca7d9ae Compare August 17, 2023 12:52
@cmaglie cmaglie merged commit 4752595 into main Aug 17, 2023
@cmaglie cmaglie deleted the fix-temp-file-cleanup branch August 17, 2023 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Temporary files are not cleaned up
2 participants