Stop command exits with 0 when no AppHost is running#14570
Open
mitchdenny wants to merge 2 commits intorelease/13.2from
Open
Stop command exits with 0 when no AppHost is running#14570mitchdenny wants to merge 2 commits intorelease/13.2from
mitchdenny wants to merge 2 commits intorelease/13.2from
Conversation
When running 'aspire stop' and no AppHost is running, the command now returns exit code 0 and displays an informational message instead of exit code 7 (FailedToFindProject) with an error message. This aligns with the expected behavior that stopping nothing is not an error. Fixes part of #14238 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 14570Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 14570" |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR makes the aspire stop command idempotent by treating the absence of a running AppHost as a success condition rather than an error. When no AppHost is found, the command now returns exit code 0 with an informational message instead of exit code 7 with an error message. This aligns with Unix conventions where idempotent operations (like stopping a non-running service) are treated as successful.
Changes:
- Modified
StopCommandto return success (exit code 0) when no AppHost is running - Changed message display from error to informational for the no-running-AppHost case
- Simplified error message handling by directly using the localized string
Contributor
🎬 CLI E2E Test RecordingsThe following terminal recordings are available for commit
📹 Recordings uploaded automatically from CI run #22174113658 |
Validates that 'aspire stop' exits with code 0 and shows an informational message when no AppHost is running, rather than returning an error exit code. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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
When running
aspire stopand no AppHost is running, the command now returns exit code 0 and displays an informational message instead of exit code 7 (FailedToFindProject) with an error message.Stopping nothing is not an error condition - it's an idempotent success.
Changes
StopCommandto returnExitCodeConstants.Success(0) instead ofExitCodeConstants.FailedToFindProject(7) when no running AppHost is foundDisplayErrortoDisplayMessage("information", ...)for the no-running-AppHost case, matching the pattern used byPsCommandAddresses part of #14238