-
Notifications
You must be signed in to change notification settings - Fork 514
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support cleaning the cache directory #696
Comments
hey there. There is no good solution unfortunately.
|
Maybe this is useful: https://stackoverflow.com/questions/18221348/exit-hook-working-both-on-bash-and-zsh |
Thanks for this!!! |
Hello~ I don't know why fnm needs to create multishells symlinks. Even if you enter the same path again, it still creates a new and different symlinks. I don't understand why it was designed this way. |
@fengyinxu It's because each shell instance can be using its own version of Node.js, so each multishell symlink is specific to one shell instance. |
Typically, what we need is a different version of Nodejs for each project, not each shell instance. I'm not familiar with rust. I'm curious as to why fnm designed it this way (cache, multishells) What is the need for this design. I see there is a PR #865 associated with the issue, but it's a pity that the PR has not been merged now. |
@fengyinxu Commands like |
Is there a reason for not creating these symlinks in |
For fish shell user: function fnm_clean_up --on-event fish_exit
rm -r $FNM_MULTISHELL_PATH
end |
the problem with using hooks is that almost no one exits their shell cleanly, so that hook will not be called. Maybe fish works better than what I tested? |
sorry for replying after more than 1 year. fnm multishells used to be in TMPDIR. Unfortunately, a MacOS change in behavior of tmpdirs made them clean up on hibernation instead of reboot. we had bug reports in this regard, which the new multishell directory fixed. I didn't find any literature about this change but changing the directory fixed it for good, so we left it like that. I think it's a good tradeoff to have: symlinks are mostly 0-sized and fast, and working software is better than broken software |
Is there a way to add a cleanup command? Maybe add the Or maybe just add the |
the problem with pid is that it isn't a shell command but an executable, so I need to use # my .zshrc
eval "$(~/.config/setup-fnm)"
# ~/setup
fnm env --use-on-cd then we need to traverse the process tree to understand what's the closest shell however we can do I don't think there's a good and easy solution here. do you have something in mind? |
tldr the main concern is that using PID might hurt composition |
I don't realize this issue already raised as I created my suggestion on #1374 I see that the problem would be on ensuring the clean up command to be executed on any shell exit? Also, it makes me wonder why do we need symlink in the first place? Why not assign the path directly to avoid creation of symlink? |
It would be great if
fnm
supported cleaning up the cache directory. Currently, I have 2398 directories in the cache directory, and I think that having a command (which maybe runs periodically when you run anyfnm
command?)that removes everything in that directory is better than having to do so manually while the folders build up.The text was updated successfully, but these errors were encountered: