elisp-tree-sitter icon indicating copy to clipboard operation
elisp-tree-sitter copied to clipboard

Process running from dynamic link

Open jcs090218 opened this issue 4 years ago • 2 comments

If I have tree-sitter running with dynamic link file (dll) then I am not able to upgrade tree-sitter-langs package.

Steps of reproduce

  1. Open any file with tree-sitter support (ensure there is process running with dll file)
  2. package-list-packages, and try to remove package tree-sitter-langs

Then you should get an error with process running, not able to delete package, etc.

Environments

  • OS: Windows 10 x64
  • Emacs version: 27.1

jcs090218 avatar Feb 12 '21 16:02 jcs090218

Windows seems to disallow deleting loaded dll files.

I'm not familiar enough with Windows to fix this, or to suggest workarounds.

ubolonton avatar Feb 17 '21 10:02 ubolonton

I think you can customize tree-sitter-langs-grammar-dir for that. So the langs dll is stored outside of package and will not be delete when upgrading.

(use-package tree-sitter-langs
  :ensure t
  :defer t
  :custom
  (tree-sitter-langs-grammar-dir (expand-file-name ".cache/tree-sitter-langs/" user-emacs-directory)))

In Windows, loaded dll cannot be deleted online but can be moved and marked to delete next time PC reboot. Perhaps package.el should use that, i.e, move loaded dll file to $TEMP and mark it as delete on reboot, then we can cleanly upgrade package on Windows without worry about file deletion error.

kiennq avatar Feb 22 '21 07:02 kiennq