Fix stop --all to return success when no app hosts are running#17463
Conversation
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 17463Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 17463" |
There was a problem hiding this comment.
Pull request overview
This pull request updates the Aspire CLI stop command so that aspire stop --all returns exit code 0 (Success) with an informational message when there are no running AppHosts, aligning it with the interactive aspire stop behavior and making scripting scenarios more predictable.
Changes:
- Adjusted
stop --allto display an informational “not running” message and returnCliExitCodes.Successwhen no AppHosts are found. - Added a parameterized test covering both
stopandstop --allfor the “no running AppHosts” scenario. - Also removes the “Logs” column from
aspire pstable output (plus associated resources/tests), which appears unrelated to the PR’s stated goal.
Reviewed changes
Copilot reviewed 18 out of 19 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/Aspire.Cli/Commands/StopCommand.cs | Changes stop --all empty-scan behavior to informational + success exit code. |
| tests/Aspire.Cli.Tests/Commands/StopCommandTests.cs | Adds test for success + message when no AppHosts are running. |
| src/Aspire.Cli/Commands/PsCommand.cs | Removes CLI log column from table output rendering. |
| tests/Aspire.Cli.Tests/Commands/PsCommandTests.cs | Removes table-format tests related to the removed “Logs” column. |
| src/Aspire.Cli/Resources/PsCommandStrings.resx | Removes HeaderCliLog resource string. |
| src/Aspire.Cli/Resources/PsCommandStrings.Designer.cs | Removes generated accessor for HeaderCliLog. |
| src/Aspire.Cli/Resources/xlf/PsCommandStrings.cs.xlf | Removes HeaderCliLog localized entry. |
| src/Aspire.Cli/Resources/xlf/PsCommandStrings.de.xlf | Removes HeaderCliLog localized entry. |
| src/Aspire.Cli/Resources/xlf/PsCommandStrings.es.xlf | Removes HeaderCliLog localized entry. |
| src/Aspire.Cli/Resources/xlf/PsCommandStrings.fr.xlf | Removes HeaderCliLog localized entry. |
| src/Aspire.Cli/Resources/xlf/PsCommandStrings.it.xlf | Removes HeaderCliLog localized entry. |
| src/Aspire.Cli/Resources/xlf/PsCommandStrings.ja.xlf | Removes HeaderCliLog localized entry. |
| src/Aspire.Cli/Resources/xlf/PsCommandStrings.ko.xlf | Removes HeaderCliLog localized entry. |
| src/Aspire.Cli/Resources/xlf/PsCommandStrings.pl.xlf | Removes HeaderCliLog localized entry. |
| src/Aspire.Cli/Resources/xlf/PsCommandStrings.pt-BR.xlf | Removes HeaderCliLog localized entry. |
| src/Aspire.Cli/Resources/xlf/PsCommandStrings.ru.xlf | Removes HeaderCliLog localized entry. |
| src/Aspire.Cli/Resources/xlf/PsCommandStrings.tr.xlf | Removes HeaderCliLog localized entry. |
| src/Aspire.Cli/Resources/xlf/PsCommandStrings.zh-Hans.xlf | Removes HeaderCliLog localized entry. |
| src/Aspire.Cli/Resources/xlf/PsCommandStrings.zh-Hant.xlf | Removes HeaderCliLog localized entry. |
Files not reviewed (1)
- src/Aspire.Cli/Resources/PsCommandStrings.Designer.cs: Language not supported
Make 'aspire stop --all' return exit code 0 (Success) with an informational message when no app hosts are running, consistent with the interactive 'aspire stop' behavior. Previously, --all returned exit code 7 (FailedToFindProject) and displayed an error, while the interactive path returned Success with an info message. This inconsistency made scripting scenarios fail unnecessarily. Also adds a parameterized test covering both the interactive and --all paths.
6955f62 to
a131586
Compare
|
❓ CLI E2E Tests unknown — 96 passed, 0 failed, 5 unknown (commit View all recordings
📹 Recordings uploaded automatically from CI run #26387671296 |
|
✅ No documentation update needed. A documentation update was prepared for Triggered signals: Prepared change: Updated the |
Description
Make
aspire stop --allreturn exit code 0 (Success) with an informational message when no app hosts are running, consistent with the interactiveaspire stopbehavior.Previously,
--allreturned exit code 7 (FailedToFindProject) and displayed an error, while the interactive path returned Success with an info message. This inconsistency made scripting scenarios fail unnecessarily.Changes
src/Aspire.Cli/Commands/StopCommand.cs: ChangedStopAllAppHostsAsyncto useDisplayMessagewithKnownEmojis.Informationand returnCliExitCodes.Successwhen no connections are found (instead ofDisplayError+FailedToFindProject).tests/Aspire.Cli.Tests/Commands/StopCommandTests.cs: Added a parameterized[Theory]test covering both the interactivestopandstop --allpaths to verify they return success with the expected informational message.Checklist