Bumping this topic back up…should the anytype-cli update command work on Windows? I have it running as a service fine, but I’m not able to run the update command. I manually removed and updated to v0.1.6 and trying to run the update command to v0.1.7 or v0.1.8 both result in the same error. I’ve tried it with the service running and with the service stopped (as an administrator).
c:\Program Files\anytype-cli>anytype.exe update
Checking for updates...
Updating from v0.1.6 to v0.1.8...
Downloading anytype-cli-v0.1.8-windows-amd64.zip...
✗ update failed: Failed to install: failed to replace binary at C:\Program Files\anytype-cli\anytype.exe. To get the latest version, reinstall from repository: https://github.com/anyproto/anytype-cli
The update command should work on Windows, but the error usually means Windows can’t replace anytype.exe because the file is still in use or locked. This can happen if the CLI is running as a service or if a process is still active even after stopping the service.
A couple of things worth checking:
• Make sure the Anytype CLI service is fully stopped
• Check Task Manager and confirm there is no anytype.exe process still running
• Then try running anytype.exe update again as administrator
If Windows still blocks the replacement, installing the latest version manually from the GitHub release (as you already did) is the correct workaround for now.
If you continue seeing this even with the service stopped and no running process, let us know and we can take a closer look.
I took a look at the code and I believe the issue is that the update is simply trying to overwrite the exe, which is running. This doesn’t work on Windows as I understand it. I created a PR that has code for windows to rename the process before trying to replace it. It seems to work.
Also, while I was testing this, v0.1.10 was released and I discovered that the version check was doing a string comparison, so it was not trying to update from older versions to v0.1.10+. In the PR I also changed the version comparison to semver.Compare so it correctly compares the versions.
Your explanation about Windows not allowing the running executable to overwrite itself makes sense, especially when the CLI is installed as a service. The rename approach sounds like a reasonable workaround for that behavior.
Good catch as well on the version comparison. Using semver comparison there definitely sounds safer than relying on string comparison.
We’ll take a look at the PR and test the changes. Really appreciate you taking the time to investigate and propose a fix.
How should I run it on Android? I think there is an option to use termux, but wouldnt that drain the battery? Also i wish to bundle it somehow inside the app.