Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use self-replace to update maa-cli self #363

Merged
merged 4 commits into from
Jan 1, 2025
Merged

Conversation

wangl-cc
Copy link
Member

@wangl-cc wangl-cc commented Jan 1, 2025

On windows, the maa-cli binary is locked by the system when it is running. This makes it impossible to update the binary directly. To solve this problem, we can use the self-replace crate to update the binary.

Besides, constcat crate is added to create some platform-specific file names. The extract function is slightly modified to accept a closure that accepts a Cow instead of a &Path.

@wangl-cc wangl-cc linked an issue Jan 1, 2025 that may be closed by this pull request
On windows, the maa-cli binary is locked by the system when it is running.
This makes it impossible to update the binary directly.
To solve this problem, we can use the self-replace crate to update the binary.

Besides, constcat crate is added to create some platform-specific file names.
The extract function is slightly modified to accept a closure that accepts a
Cow<Path> instead of a &Path.
Copy link

codecov bot commented Jan 1, 2025

Codecov Report

Attention: Patch coverage is 3.12500% with 31 lines in your changes missing coverage. Please review.

Project coverage is 66.22%. Comparing base (e4e1cbc) to head (2c3f29a).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
crates/maa-cli/src/installer/extract.rs 0.00% 25 Missing ⚠️
crates/maa-cli/src/installer/maa_cli.rs 0.00% 5 Missing ⚠️
crates/maa-cli/src/installer/maa_core.rs 50.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #363   +/-   ##
=======================================
  Coverage   66.22%   66.22%           
=======================================
  Files          42       42           
  Lines        3624     3624           
=======================================
  Hits         2400     2400           
  Misses       1224     1224           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@wangl-cc wangl-cc merged commit d57c81b into main Jan 1, 2025
21 of 22 checks passed
@wangl-cc wangl-cc deleted the fix/self-replace branch January 1, 2025 22:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error 拒绝访问(os error 32)
1 participant