Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Redirect human-readable messages to stderr when --format json is used#14572

Open
mitchdenny wants to merge 2 commits intorelease/13.2from
fix/detach-json-stdout-contamination
Open

Redirect human-readable messages to stderr when --format json is used#14572
mitchdenny wants to merge 2 commits intorelease/13.2from
fix/detach-json-stdout-contamination

Conversation

@mitchdenny
Copy link
Member

Summary

When runningaspire run --detach --format json, human-readable messages like "Finding apphosts..." and "Stopping previous instance..." were written to stdout alongside the JSON output, making it impossible to parse the JSON programmatically.

Changes

  • AddedUseStderrForMessages property toIInteractionService with a default no-op implementation
  • ConsoleInteractionService routes all human-readable display methods (DisplayMessage,DisplaySuccess,DisplayError,ShowStatusAsync, etc.) through aMessageConsole property that returns_errorConsole (stderr) when the flag is set
  • DisplayRawText remains on stdout — this is used for the structured JSON output
  • ExecuteDetachedAsync inRunCommand setsUseStderrForMessages = true when--format json is specified

Before

$ aspire run --detach --format json🔍 Finding apphosts...apphost.cs🛑 Stopping previous instance (AppHost PID: 89136, CLI PID: 15160)✔  Running instance stopped successfully.{  "appHostPath": "...",  ...}

After

$ aspire run --detach --format json{"appHostPath":"...","appHostPid":70740,"cliPid":64920,...}

Human-readable messages still appear on stderr so users can see progress when running interactively, butstdout | jq now works correctly.

Fixes#14423

When running `aspire run --detach --format json`, messages like"Finding apphosts..." and "Stopping previous instance..." were writtento stdout alongside the JSON output, making it impossible to parse theJSON programmatically.Add a `UseStderrForMessages` property to IInteractionService. Whenenabled, ConsoleInteractionService routes all human-readable displaymethods through stderr while keeping DisplayRawText on stdout forstructured output. The property is set in ExecuteDetachedAsync whenthe output format is JSON.Fixes#14423Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
CopilotAI review requested due to automatic review settingsFebruary 19, 2026 07:23
@github-actions
Copy link
Contributor

github-actionsbot commentedFeb 19, 2026
edited
Loading

🚀Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh| bash -s -- 14572

Or

  • Run remotely in PowerShell:
iex"& {$(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 14572"

Copy link
Contributor

CopilotAI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Pull request overview

This pull request fixes issue#14423 where human-readable messages were being written to stdout alongside JSON output when runningaspire run --detach --format json, making the JSON output unparseable by automated tools.

Changes:

  • AddedUseStderrForMessages property toIInteractionService to enable routing human-readable messages to stderr
  • ModifiedConsoleInteractionService to route display methods through aMessageConsole property that returns stderr when the flag is set
  • SetUseStderrForMessages = true inRunCommand.ExecuteDetachedAsync when--format json is specified

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

FileDescription
src/Aspire.Cli/Interaction/IInteractionService.csAddedUseStderrForMessages property with default no-op implementation
src/Aspire.Cli/Interaction/ConsoleInteractionService.csImplementedUseStderrForMessages property and routed all message display methods throughMessageConsole that redirects to stderr when flag is set;DisplayRawText correctly stays on stdout
src/Aspire.Cli/Commands/RunCommand.csSetsUseStderrForMessages = true when running in detached mode with JSON format

@github-actions
Copy link
Contributor

github-actionsbot commentedFeb 19, 2026
edited
Loading

🎬 CLI E2E Test Recordings

The following terminal recordings are available for commit4d0a4b8:

TestRecording
AgentCommands_AllHelpOutputs_AreCorrect▶️ View Recording
AgentInitCommand_MigratesDeprecatedConfig▶️ View Recording
Banner_DisplayedOnFirstRun▶️ View Recording
Banner_DisplayedWithExplicitFlag▶️ View Recording
CreateAndDeployToDockerCompose▶️ View Recording
CreateAndDeployToDockerComposeInteractive▶️ View Recording
CreateAndPublishToKubernetes▶️ View Recording
CreateAndRunAspireStarterProject▶️ View Recording
CreateAndRunAspireStarterProjectWithBundle▶️ View Recording
CreateAndRunJsReactProject▶️ View Recording
CreateAndRunPythonReactProject▶️ View Recording
CreateEmptyAppHostProject▶️ View Recording
CreateStartAndStopAspireProject▶️ View Recording
CreateStartWaitAndStopAspireProject▶️ View Recording
CreateTypeScriptAppHostWithViteApp▶️ View Recording
DoctorCommand_DetectsDeprecatedAgentConfig▶️ View Recording
DoctorCommand_WithSslCertDir_ShowsTrusted▶️ View Recording
DoctorCommand_WithoutSslCertDir_ShowsPartiallyTrusted▶️ View Recording
LogsCommandShowsResourceLogs▶️ View Recording
PsCommandListsRunningAppHost▶️ View Recording
ResourcesCommandShowsRunningResources▶️ View Recording
StagingChannel_ConfigureAndVerifySettings_ThenSwitchChannels▶️ View Recording

📹 Recordings uploaded automatically fromCI run #22208382250

…enum- Add ConsoleOutput enum (Standard, Error) for explicit console targeting- Replace DIM UseStderrForMessages with standard DefaultConsole property- Add optional ConsoleOutput parameter to DisplayRawText for explicit targeting- Update all IInteractionService implementationsCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@mitchdenny
Copy link
MemberAuthor

/deployment-test

@github-actions
Copy link
Contributor

🚀Deployment tests starting on PR#14572...

This will deploy to real Azure infrastructure. Results will be posted here when complete.

View workflow run

@github-actions
Copy link
Contributor

Deployment E2E Tests passed

Summary: 21 passed, 0 failed, 0 cancelled

View workflow run

Passed Tests

  • ✅ AcaCompactNamingUpgradeDeploymentTests
  • ✅ AcaStarterDeploymentTests
  • ✅ AksStarterWithRedisDeploymentTests
  • ✅ AcaCompactNamingDeploymentTests
  • ✅ AksStarterDeploymentTests
  • ✅ AppServicePythonDeploymentTests
  • ✅ AzureContainerRegistryDeploymentTests
  • ✅ VnetStorageBlobConnectivityDeploymentTests
  • ✅ VnetStorageBlobInfraDeploymentTests
  • ✅ VnetSqlServerInfraDeploymentTests
  • ✅ VnetKeyVaultInfraDeploymentTests
  • ✅ VnetKeyVaultConnectivityDeploymentTests
  • ✅ AuthenticationTests
  • ✅ AppServiceReactDeploymentTests
  • ✅ AzureEventHubsDeploymentTests
  • ✅ AzureStorageDeploymentTests
  • ✅ AzureServiceBusDeploymentTests
  • ✅ PythonFastApiDeploymentTests
  • ✅ AzureKeyVaultDeploymentTests
  • ✅ AzureAppConfigDeploymentTests
  • ✅ AzureLogAnalyticsDeploymentTests

🎬 Terminal Recordings

TestRecording
DeployAzureAppConfigResource▶️ View Recording
DeployAzureContainerRegistryResource▶️ View Recording
DeployAzureEventHubsResource▶️ View Recording
DeployAzureKeyVaultResource▶️ View Recording
DeployAzureLogAnalyticsResource▶️ View Recording
DeployAzureServiceBusResource▶️ View Recording
DeployAzureStorageResource▶️ View Recording
DeployPythonFastApiTemplateToAzureAppService▶️ View Recording
DeployPythonFastApiTemplateToAzureContainerApps▶️ View Recording
DeployReactTemplateToAzureAppService▶️ View Recording
DeployStarterTemplateToAks▶️ View Recording
DeployStarterTemplateToAzureContainerApps▶️ View Recording
DeployStarterTemplateWithKeyVaultPrivateEndpoint▶️ View Recording
DeployStarterTemplateWithRedisToAks▶️ View Recording
DeployStarterTemplateWithStorageBlobPrivateEndpoint▶️ View Recording
DeployVnetKeyVaultInfrastructure▶️ View Recording
DeployVnetSqlServerInfrastructure▶️ View Recording
DeployVnetStorageBlobInfrastructure▶️ View Recording
DeployWithCompactNamingFixesStorageCollision▶️ View Recording
UpgradeFromGaToDevDoesNotDuplicateStorageAccounts▶️ View Recording

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@JamesNKJamesNKJamesNK left review comments

Copilot code reviewCopilotCopilot left review comments

At least 1 approving review is required to merge this pull request.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

aspire run --detach --format json still dumps other outputs to stdout making it hard to parse the json

2 participants

@mitchdenny@JamesNK

Comments


[8]ページ先頭

©2009-2026 Movatter.jp