Skip to main content

proto v0.26 - New native shim implementation

· 3 min read
Miles Johnson

After many release candidates, and a ton of testing, proto v0.26 is finally here!

Rethinking shims

proto at its core is a version manager, which means like most version managers, it relies on a concept known as shims. Shims are lightweight executable scripts that act like a proxy to the underlying binary, and are useful for proto to intercept executions and inject custom functionality, like our dynamic version detection.

On Unix machines, we relied on Bash scripts for shims, which worked rather well. However, on Windows, we relied on PowerShell scripts (.ps1), batch/cmd scripts (.cmd), and Bash scripts, all with differing levels of functionality, and each serving a separate purpose. Windows support did not work well.

To avoid current and future compatibility issues, we needed a truly native solution, and that's exactly what we did. In this release, we wrote our own Rust based executable, that will replace all of the custom shim scripts. This new executable is named proto-shim (proto-shim.exe on Windows) and is published alongside the proto binary.

This new executable solves all of the following problems (hopfully):

  • Locatable on PATH (is an .exe for Windows)
  • Can pipe/redirect data
  • Handles stdin prompts/interactivity
  • Supports ctrl+c interruptions
  • Passes parent signals to child processes (uses execvp on Unix)
  • Attempts to kill child processes on parent exit
  • Bubbles exit codes
  • Native performance
  • Doesn't require special privileges (no symlinks)

Upgrade troubleshooting

Because this release adds a new executable (proto-shim), you'll most likely run into issues when upgrading via proto upgrade. The root issue is that the upgrade process was only aware of the single proto file, and not the new proto-shim file, so it will not copy the shim into the correct location, and subsequent proto commands will fail.

We could backport this change to v0.25, but it would require all users to upgrade to that patch version first before upgrading to v0.26. But this still wouldn't solve the issue for users upgrading from v0.24, or an even earlier version.

The best way to remedy this situation is to simply re-install proto as a whole. Once you're on v0.26, this will be a non-issue.

# Unix
curl -fsSL | bash

# Windows
irm | iex

Other changes

View the official release for a full list of changes.

  • Added basic telemetry to track tool install/uninstall metrics.
  • Fixed an issue where binaries were being symlinked with broken versions in their file name (most commonly for Python).