diff --git a/CHANGELOG.md b/CHANGELOG.md index 596d9e4c4..2d04a23d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,8 @@ ## {{ UNRELEASED_VERSION }} - [{{ UNRELEASED_DATE }}]({{ UNRELEASED_LINK }}) -* Fixed `lando shellenv` failing when shell profile is empty -* Fixed `lando shellenv` to always include `~/.lando/bin` and include it first +* Fixed `lando shellenv` so it doesn't fail when `shell` profile is empty +* Fixed `lando update` so it removes lingering `lando.exe`s in the update bin directory +* Improved `lando shellenv` so that it always includes `~/.lando/bin` and includes it first * Improved messaging on `lando shellenv --add` ## v3.23.11 - [November 20, 2024](https://github.com/lando/core/releases/tag/v3.23.11) diff --git a/lib/updates.js b/lib/updates.js index 8ace61653..0e4a9926a 100644 --- a/lib/updates.js +++ b/lib/updates.js @@ -6,6 +6,7 @@ const get = require('lodash/get'); const getOctokit = require('../utils/get-octokit'); const os = require('os'); const path = require('path'); +const remove = require('../utils/remove'); const semver = require('semver'); const uniqBy = require('lodash/uniqBy'); @@ -249,7 +250,13 @@ module.exports = class UpdateManager { // refresh the "symlink" require('../utils/link-bin')(this._cli.installPath, dest, {debug: this.debug}); - // is link is not in PATH then attempt to add it + // if lando.exe exists on windows in the install path then remove it so the link has primacy + // in PATHEXT hierarchy + if (process.platform === 'win32' && fs.existsSync(path.join(this._cli.installPath, filename))) { + remove(path.join(this._cli.installPath, filename)); + } + + // if link is not in PATH then attempt to add it // @NOTE: feels sufficient to just check for `lando` since it _should_ exist in win and posix if (!require('../utils/is-in-path')(path.join(this._cli.installPath, 'lando'))) { const binPaths = require('../utils/get-bin-paths')(this._cli);