Platform-Specific Binary Downloads #141
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR implements platform and architecture detection for the
self-update
command, allowing it to download the appropriate binary based on the user's system.Changes
BinaryNameBuilder
class to generate platform-specific binary names (e.g.,ctx-1.22.0-darwin-arm64
)How It Works
linux
,darwin
,windows
) and architecture (amd64
,arm64
)ctx-1.22.0-linux-amd64
)ctx
orctx.phar
)Fix: Self-update command fails with "Text file busy" error
When executing the
self-update
command, the application was trying to overwrite the currently running PHAR file, which resulted in the following error:I've implemented a robust binary updating system that handles the "Text file busy" scenario:
Created a
BinaryUpdater
class that:Implemented platform-specific update strategies:
UnixUpdateStrategy
- Creates a bash script that runs after the process exitsWindowsUpdateStrategy
- Creates a batch script for Windows environmentsUpdated
SelfUpdateCommand
to use the newBinaryUpdater
systemThe update process now:
This approach ensures that the update completes successfully even when the binary is currently in use, and it works correctly across different platforms.