GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Update `check_shim_reachable` to correctly handle Windows by charlespierce · Pull Request #1846 · volta-cli/volta

Conversation

@charlespierce

@charlespierce charlespierce commented Aug 15, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Closes #1845

Info

We have a helper utility check_shim_reachable that notifies the user if the shim for a tool they just installed is on their PATH and whether it's shadowed. However, that check currently assumes that all shims are in VoltaHome::shim_dir. Unfortunately, on Windows that isn't the case—we install the default shims alongside Volta itself inside of Program Files.

To prevent showing an unnecessary message to Windows users, we should properly check both Volta directories on Windows when validating whether a shim is properly available on the Path.

Changes

  • Updated check_shim_reachable to call a new function find_expected_shim_dir to determine which directory should be used as the base when checking for the shim.
  • Implemented find_expected_shim_dir for both Unix and Windows;
    • On Unix it always returns the shim directory inside of VOLTA_HOME, because all of the shims are installed there, even the default ones.
    • On Windows, it first checks the VOLTA_HOME shim directory, and if the shim isn't found there, it defaults to the VoltaInstall root directory, which should be where Volta itself is installed.
  • Also updated the check to use starts_with rather than a pure equality to determine if the resolved binary matches the expectation or not.

Tested

  • Ran locally on Windows and validated that the note about shadowing doesn't show incorrectly.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@charlespierce
Update check_shim_reachable to correctly handle Windows
bf8078a
We have a helper utility `check_shim_reachable` that notifies the user if the shim
for a tool they just installed is on their PATH and whether it's shadowed. However,
that check currently assumes that all shims are in `VoltaHome::shim_dir`. Unfortunately,
on Windows that isn't the case—we install the default shims alongside Volta itself
inside of `Program Files`.

To prevent showing an unnecessary message to Windows users, we should properly check
both Volta directories on Windows when validating whether a shim is properly available
on the Path.
rwjblue
rwjblue approved these changes Aug 15, 2024
View reviewed changes
@rwjblue
rwjblue merged commit 6142614 into volta-cli:main Aug 15, 2024
@charlespierce
charlespierce deleted the check_shim_windows branch August 16, 2024 17:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@rwjblue rwjblue rwjblue approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

volta install node on Windows incorrectly shows a warning about Node being shadowed

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@charlespierce @rwjblue
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.