Write empty JSON from aspire ps to stdout#14662
Merged
JamesNK merged 2 commits intorelease/13.2from Feb 25, 2026
Merged
Conversation
Contributor
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 14662Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 14662" |
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes aspire ps --format json to emit an empty JSON array to stdout (not stderr) when there are no running AppHosts, aligning with structured-output expectations in the CLI.
Changes:
- Route the no-results JSON output (
[]) explicitly to stdout. - Expand
PsCommandJSON tests to validate deserialization and field mapping for non-empty results. - Add a regression assertion ensuring no-results JSON output is
[]on stdout.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/Aspire.Cli/Commands/PsCommand.cs | Writes [] via DisplayRawText(..., ConsoleOutput.Standard) to guarantee stdout for JSON no-results case. |
| tests/Aspire.Cli.Tests/Commands/PsCommandTests.cs | Adds/extends coverage for JSON output validity and asserts [] is written to stdout for no-results. |
sebastienros
approved these changes
Feb 24, 2026
davidfowl
approved these changes
Feb 25, 2026
Contributor
🎬 CLI E2E Test RecordingsThe following terminal recordings are available for commit
📹 Recordings uploaded automatically from CI run #22375717145 |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Description
I noticed
aspire pswas incorrectly writing an empty result to stderr instead of stdout.Checklist
<remarks />and<code />elements on your triple slash comments?aspire.devissue: