Skip to content

CLI tool does not update when using Windows #1147

Open
@mattc-cogapp

Description

@mattc-cogapp

We run automated scripts on a Windows machine to populate a database and then switch environment variables to switch between them (a sort of cursory green/blue style workflow). Unfortunately, the build scripts have to be run on Windows due to a particular tool we use that does not run very well at the moment on Linux machines.

As part of these scripts, we run the Platform.sh CLI commands to update environment variables. This was working well for a while, but now when we get prompted to update the CLI if a new verison is available, Windows reports the CLI as having been updated - but this is not actually the case.

When running in verbose mode, we can see that there's an access denied error:

C:\Users\cogapp>platform self:update -vvv
...
Update to version 3.81.0? [Y/n] y
Updating to version 3.81.0
Deprecated: version_compare(): Passing null to parameter [#1](https://support.platform.sh/hc/requests/1) ($version1) of type string is deprecated in phar://C:/Users/cogapp/.platformsh/bin/platform/vendor/padraic/phar-updater/src/VersionParser.php on line 165
Warning: rename(C:\Users\cogapp\.platformsh\bin/platform.phar.temp,C:\Users\cogapp\.platformsh\bin\platform): Access is denied (code: 5) in phar://C:/Users/cogapp/.platformsh/bin/platform/vendor/padraic/phar-updater/src/Updater.php on line 382
The Platform.sh CLI has been successfully updated to version 3.81.0

C:\Users\cogapp>platform --version
Platform.sh CLI 3.80.3

However the message afterwards is misleading, as the CLI tool has not actually been updated.

I suppose this boils down to two things:

  1. Should this work under Windows? If so - then the above is a legitimate error (at least for us).
  2. Should the error message say something else in the event that an error occurred during an update?

We're currently running PHP 8.1.7 on an AWS Windows machine (I believe it's one of the old Enterprise LTS Windows versions - 20H2 or something like that)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions