swiftly icon indicating copy to clipboard operation
swiftly copied to clipboard

Overwrite prompt of Use gets cancelled in non-interactive Linux environments

Open vzsg opened this issue 2 years ago • 2 comments
trafficstars

When running swiftly use in a non-interactive environment, in my case a Heroku buildpack, the following section in the Linux implementation of use gets immediately cancelled: Linux.swift#L69-L86, and the symlinks are never overwritten.

My use case would greatly benefit from a --disable-confirmation flag, like the swiftly install script does, which would suppress the file list (it's noise) and would silently overwrite the symlinks.

vzsg avatar Oct 12 '23 21:10 vzsg

Actually, a --force flag for might be even better, that would recreate the symlinks

  • even if the config JSON says that the current version is already in use
  • without confirmation

vzsg avatar Oct 13 '23 07:10 vzsg

The prompt being overridden here is a pretty important one--it's verifying that you're okay with overwriting existing third party tools with special versions that Swift bundles in its own toolchain. Doing so can be extremely disruptive, since these Swift-specific versions will not match the behavior of the old versions they're overwriting. That said, I can imagine this being useful in in containerized environments where you might only really care about Swift being installed and the existing executables don't matter, though this flag should still be used with extreme care.

If I recall, your use case was that you had a corrupt installation of swiftly and needed to overwrite the config.json file and dangling symlinks from a prior installation (due to #82). This should be a rare case that wouldn't be encountered in the course of normal usage (sans bugs), so I don't think we'll want to override the config.json with this. In the future, we may want to introduce a repair command or something like that to handle those cases.

patrickfreed avatar Nov 15 '23 04:11 patrickfreed