-
Notifications
You must be signed in to change notification settings - Fork 238
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
Replace Windows symlinks with volta run
scripts
#1755
Conversation
Using symlinks on Windows requires that our users enable Developer mode, which isn't always possible. For directory links, there is an easy solution: NTFS Junctions. These work the same as symlinks but do not require administrator privileges nor developer mode.
Rather than using symlinks, which require administrator privileges or developer mode on Windows, we can instead use small scripts that call out to 'volta run' to actually handle the execution of 3rd party binaries. This also adds a migration to a new v4 layout, which allows Windows installs to migrate immediately to using the script-based shims.
2ddbf4a
to
fa04c75
Compare
Hey @charlespierce, great work! Did you find time to check how it affects performance? I'd be happy to help if some more work is needed to go forward with it, let me know. |
Was able to get some testing done, and from what I can tell it doesn't have any major effect on performance, so this should be good to go 🎉 |
pub fn shim_file(&self, toolname: &str) -> PathBuf { | ||
// On Windows, shims are created as `<name>.cmd` since they | ||
// are thin scripts that use `volta run` to execute the command | ||
#[cfg(windows)] | ||
let toolname = format!("{}{}", toolname, ".cmd"); | ||
|
||
path_buf!(self.shim_dir.clone(), toolname) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For posterity, this is the only difference between the v3 and v4 layouts, and this is the diff:
pub fn shim_file(&self, toolname: &str) -> PathBuf {
- path_buf!(self.shim_dir.clone(), executable(toolname))
+ // On Windows, shims are created as `<name>.cmd` since they
+ // are thin scripts that use `volta run` to execute the command
+ #[cfg(windows)]
+ let toolname = format!("{}{}", toolname, ".cmd");
+
+ path_buf!(self.shim_dir.clone(), toolname)
}
Closes #1397
Info
volta run <package>
.Changes
junction
to create NTFS junctions instead of directory symlinks (this part is directly copied from No more symlinks on Windows #1552)shim
module to have different implementations ofcreate
for Unix and Windows..cmd
script that callsvolta run
for the shim. It also continues to create a custom Git Bash script, though that script is updated to now callvolta run
directly, instead of calling the existing shim viacmd.exe
v4
layout since the shim file on Windows is now<binary>.cmd
instead of<binary>.exe
.v4
that removes and regenerates the shims, making sure that the old symlinks are removed. The migration also updates any existing directory symlinks to use junctions as well.Tested
volta run
approach ⚡