CLI: Enhance image and container inspection behavior#40315
Open
AmelBawa-msft wants to merge 2 commits intofeature/wsl-for-appsfrom
Open
CLI: Enhance image and container inspection behavior#40315AmelBawa-msft wants to merge 2 commits intofeature/wsl-for-appsfrom
AmelBawa-msft wants to merge 2 commits intofeature/wsl-for-appsfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates WSLC’s image inspect and container inspect CLI behavior to be more consistent with other “inspect” commands by returning JSON output (including partial results) even when some requested objects are missing, while emitting localized “not found” errors and a non-zero exit code.
Changes:
- Update
image inspectto handle missing images by emitting a localized error, returning[]/partial JSON on stdout, and setting exit code to1rather than failing the whole command. - Add end-to-end test coverage for
container inspect, including success, not-found, multi-inspect, and mixed found/not-found scenarios. - Add a new localized string for the image-not-found error message.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| test/windows/wslc/e2e/WSLCE2EImageInspectTests.cpp | Updates expected output for image-not-found to match new inspect behavior (JSON on stdout + localized stderr). |
| test/windows/wslc/e2e/WSLCE2EContainerInspectTests.cpp | Adds e2e tests validating help, missing args, not-found, single/multi inspect, and mixed results for container inspect. |
| src/windows/wslc/tasks/ImageTasks.cpp | Implements “try inspect” behavior for images to allow partial results and per-item not-found reporting. |
| src/windows/wslc/tasks/ContainerTasks.cpp | Implements “try inspect” behavior for containers to allow partial results and per-item not-found reporting. |
| localization/strings/en-US/Resources.resw | Adds MessageWslcImageNotFound localized string used by the new image inspect behavior. |
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.
Summary of the Pull Request
catch not-found errors and print a friendly localized message to stderr instead of throwing an
unhandled exception.
PR Checklist
Detailed Description of the Pull Request / Additional comments
Validation Steps Performed