volta-cli / volta

Volta: JS Toolchains as Code. ⚡
https://volta.sh
Other
10.91k stars 227 forks source link

[Windows] Investigate creating a lightweight symlink replacement #579

Open charlespierce opened 4 years ago

charlespierce commented 4 years ago

Symlinks in Windows come with a bunch of restrictions and edge-cases that make it hard for Volta to correctly determine the name of the tool that was called. A few of these include:

We could possibly solve these problems by creating a small executable that we could actually copy with a new name when creating a shim. This executable would be responsible for determining the command (possible because it's actually an on-disk executable) and then passing control to the full Volta shim while passing information about the tool (possibly using an Environment Variable).

charlespierce commented 4 years ago

Alternatively, possibly look into creating the shims with hard links instead of symlinks, which in some quick testing appears to work. This will also probably require setting the Permission setting "WriteAttributes" on the installed shim.exe in the WiX configuration.

gerred commented 4 years ago

I think I might be seeing this issue when using https://github.com/nushell/nushell on anything going through volta-shim.exe as well, FWIW.

felipecrs commented 3 years ago

For reference, Chocolatey have a shim generator called shimgen, https://github.com/chocolatey/shimgen. It works well for me under any scenario: Git Bash, Powershell, cmd, UNCs.

chawyehsu commented 3 years ago

For reference, Chocolatey have a shim generator called shimgen, https://github.com/chocolatey/shimgen. It works well for me under any scenario: Git Bash, Powershell, cmd, UNCs.

that shimgen is pretty slow and so many choco users complain about it, moreover, it's a closed source software.

felipecrs commented 3 years ago

There is also Scoop's Shim, https://github.com/ScoopInstaller/Shim. Very simple to use.

felipecrs commented 3 years ago

that shimgen is pretty slow and so many choco users complain about it, moreover, it's a closed source software.

Still about shimgen, there is https://github.com/turboBasic/shimPsy.

chawyehsu commented 3 years ago

There is also Scoop's Shim, https://github.com/ScoopInstaller/Shim. Very simple to use.

Well, I'm one of the maintainers of Scoop and I know that. the initial version of Scoop's shim isn't robust. FYI, there are variants available, such as https://github.com/71/scoop-better-shimexe and https://github.com/kiennq/scoop-better-shimexe.

And I always want to see a modern, independent, well-designed implementation of Windows shimming tool.

eugenesvk commented 2 years ago

There is also a Rust version (from Scoop) https://github.com/zoritle/rshim, which Rust Volta might like better :)