refactor(wsl): relax WSL error judgment#106
Merged
ihexon merged 1 commit intooomol-lab:mainfrom Apr 23, 2025
Merged
Conversation
Signed-off-by: Kevin Cui <bh@bugs.cc>
There was a problem hiding this comment.
Pull Request Overview
This PR relaxes the WSL error judgment to accommodate variations in error codes introduced by Microsoft.
- Removed module-specific prefixes from error message substring checks in MountVHDX, UmountVHDX, and MoveDistro functions.
- Adjusted error handling to be more flexible by checking for core error codes without their former qualifiers.
Comments suppressed due to low confidence (2)
pkg/wsl/distro.go:109
- Relaxing the error check by removing the module prefix improves flexibility; however, verify that the substring matching will not inadvertently capture unrelated error messages in the future.
if strings.Contains(err.Error(), "WSL_E_USER_VHD_ALREADY_ATTACHED") {
pkg/wsl/distro.go:137
- The removal of the module-specific prefix in the MoveDistro error check makes the matching more permissive; ensure this change does not unintentionally catch non-targeted errors.
if strings.Contains(err.Error(), "ERROR_SHARING_VIOLATION") {
ihexon
approved these changes
Apr 23, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
We found that Microsoft sometimes modifies the WSL error codes. To avoid this, we relax the handling of error codes.