Skip to content
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

Check if the cli tool already exists #2054

Open
ahaoboy opened this issue Feb 15, 2025 · 3 comments
Open

Check if the cli tool already exists #2054

ahaoboy opened this issue Feb 15, 2025 · 3 comments

Comments

@ahaoboy
Copy link

ahaoboy commented Feb 15, 2025

I installed fnm to ~/tool/fnm using the official fnm installation script

Then use cargo binstalll fnm to install fnm to ~/.cargo/fnm

This results in two copies of fnm, and ~/tool has a higher priority than ~/.cargo in the system path.

When I use cargo binstall fnm to install the latest version again, although the latest version is installed to ~/.cargo, the old version is still used in shell

Is it possible to add a detection that if the installed program already exists and is not in ~/.cargo, the user should be prompted that this may be a risk?

@NobodyXu

This comment has been minimized.

1 similar comment
@NobodyXu
Copy link
Member

Hmmm yes it'd be possible, since we have the BinFile we can just try locating them, but there could be a program with the same name

We can also try executing it and checking status, but some program might fail when no cmdline argument is passed.

We could use checksum but if it's different version then it's no good.

My opinion is that it's possible but it would not be perfect and there will be false positives and false negatives, it can only serve as a hint and user has to manually verify.

@ahaoboy
Copy link
Author

ahaoboy commented Feb 15, 2025

My opinion is that it's possible but it would not be perfect and there will be false positives and false negatives, it can only serve as a hint and user has to manually verify.

It doesn't need to be perfect, and it doesn't need to check the version, just a warning prompt is enough.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants