volta icon indicating copy to clipboard operation
volta copied to clipboard

Replace Windows symlinks with `volta run` scripts

Open charlespierce opened this issue 1 year ago • 1 comments
trafficstars

Closes #1397

Info

  • Huge kudos to @rcsilva83 and @Xstoudi for a bunch of iteration in #1552 on removing symlinks for Windows, to allow dropping the requirement for Developer Mode.
  • Based on discussions in that PR, we had a new idea for replacing symlink shims on Windows by using scripts that call volta run <package>.
  • This is a first-pass implementation of creating simple script-based shims for executing 3rd-party binaries on Windows.
  • This should be a no-op for Unix.

Changes

  • Used junction to create NTFS junctions instead of directory symlinks (this part is directly copied from #1552)
  • Updated the shim module to have different implementations of create for Unix and Windows.
    • The Unix implementation is the same as it was before.
    • The Windows implementation creates a very simple .cmd script that calls volta run for the shim. It also continues to create a custom Git Bash script, though that script is updated to now call volta run directly, instead of calling the existing shim via cmd.exe
  • Create a new v4 layout since the shim file on Windows is now <binary>.cmd instead of <binary>.exe.
  • Created a migration to 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

  • Installed packages using the current Volta version (i.e. with symlinks).
  • Installed a new version of Volta based on these changes.
  • Verified that running the existing packages still works and that the shims were properly migrated.
  • Turned off developer mode.
  • Verified that even without developer mode, I could install and run new packages 🎉

Notes

  • I still need to do some performance testing to see how this change affects performance. I would expect it to be roughly equivalent to the old approach, but want to test that to be sure.

charlespierce avatar May 16 '24 06:05 charlespierce