version-fox / vfox

A cross-platform and extendable version manager with support for Java, Node.js, Flutter, .Net & more

Home Page:https://vfox.lhan.me

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG]: Creating a new terminal across the day cleans the temporary directory, causing the directory link in use to be deleted

jan-bar opened this issue · comments

Version
0.5.3
OS
Windows

Describe the bug
1716134400 -> 2024-05-20 00:00:001716220800 -> 2024-05-21 00:00:00

The terminal created on 2024-05-20 never exits

Create a new terminal on 2024-05-21 to trigger the temporary directory cleanup logic

Then the temporary directory used by the terminal created on 2024-05-20 was deleted, and the temporary directory of 2024-05-21 was generated. However, the terminal did not switch to the new temporary directory, and the corresponding temporary directory was not created directory link

image

The terminal created on 2024-05-20 never exits

This situation was never considered from the beginning. : |

If we want to solve this issue, we have to see if the process is still alive as you suggested before we clean up.

#280 (comment)

If we want to solve this issue, we have to see if the process is still alive as you suggested before we clean up.

This solution needs to support cross-platform detection of whether the pid is running, which is not easy to implement.

According to the above situation, when the terminal executes vfox env -s xxx , a new temporary directory will be created, but the relevant directory link is missing in the directory. And the environment variables are not updated to the new temporary directory.

Add cross-day detection to the vfox env -s xxx command. When a cross-day occurs, a new temporary directory will be generated and new environment variables will take effect. What about this solution?

It is worth mentioning that fnm: Schniz/fnm#696 has not yet completed cleaning up the history files.

If we want to solve this issue, we have to see if the process is still alive as you suggested before we clean up.

This library can find the currently running process:https://github.com/mitchellh/go-ps