Display "Stopping Aspire..." immediately on CTRL+C#17652
Conversation
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 17652Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 17652" |
|
Too big/risky for 13.4. |
a4ef058 to
e90384d
Compare
|
A couple of things worth flagging before this merges: 1. Wait for the release/13.4 merge-back first. PR #17817 (Merge release/13.4 to main after v13.4.0 release) hasn't landed yet, and there are 18 unmerged commits on 2. Watch |
mitchdenny
left a comment
There was a problem hiding this comment.
@JamesNK — went ahead and merged main into your branch to resolve the conflicts from #17817. Two touches needed:
src/Aspire.Cli/Packaging/PackagingService.cs— using-block conflict, combined both sides (keptSystem.Globalization/System.Reflection/System.Securityfrom your branch, addedAspire.Cli.Acquisitionfrom main).src/Aspire.Cli/Commands/CacheCommand.cs— auto-merged, but new code pulled from main referencesCliPathHelperwithout theAspire.Cli.Utilsusing. Added it.
Aspire.Cli + Aspire.Cli.Tests build clean and the impacted tests (BaseCommandTests, PackagingServiceTests, CacheCommandTests — 100 total) pass locally. Pushed as commit 9ddf355 — please give it a look and merge when you're happy.
9ddf355 to
20216a7
Compare
- Introduce CommonCommandServices to consolidate BaseCommand dependencies - Move cancellation/termination handling from Program.Main into BaseCommand - Show 'Stopping Aspire...' after 200ms if handler hasn't completed post-cancellation - Add CancellationManager to CliStartupContext and DI container - Map CliExitCodes.Cancelled in CommandResult.FromExitCode - Change ConsoleCancellationManager.SetStartedHandler to accept Task (not Task<int>) - Add BaseCommand tests for cancellation message timing - Add 'using' to BuildServiceProvider() calls in CLI tests to fix file handle leaks
3a4361a to
d807703
Compare
…nt local variable
|
❌ CLI E2E Tests failed — 111 passed, 1 failed, 2 unknown (commit ❌ Failed Tests
View all recordings
📹 Recordings uploaded automatically from CI run #26869467008 |
Update the 'Stopping the AppHost' section of aspire-run.mdx to note that the CLI displays a '🛑 Stopping Aspire...' message shortly after the user presses Ctrl+C, confirming that shutdown is in progress. Documents the user-facing behavior added by microsoft/aspire#17652. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Pull request created: #1201
|
|
📝 Documentation has been drafted in microsoft/aspire.dev#1201 targeting Updated Note This draft PR needs human review before merging. |
Track the BaseCommand ctor consolidation from #17652 (merged to main 2026-06-03), which replaced the individual IFeatures + ICliUpdateNotifier + CliExecutionContext + IInteractionService + AspireCliTelemetry parameters with a single CommonCommandServices bag. TerminalCommand, TerminalAttachCommand, and TerminalPsCommand now take CommonCommandServices and forward it to base(...). Per-command-specific deps (IAuxiliaryBackchannelMonitor, IProjectLocator, ILogger<T>) are still direct parameters resolved by DI. _interactionService field and AppHostConnectionResolver construction now pull from services.* instead of the deleted parameters. Also drop now-unused usings (Configuration, Telemetry, Utils on the parent TerminalCommand; Configuration + Telemetry on the two leaves; the TerminalPsCommand keeps Utils for the AddBoldColumn extension method). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Summary
When the user presses CTRL+C, the CLI now displays "Stopping Aspire..." after a short 200ms delay if the command handler hasn't completed yet. This gives immediate user feedback that shutdown is in progress.
Changes
Core feature
Program.Maininto theSetActionlambda. Uses aTask.WhenAnyloop with a 200msTaskCompletionSourcetimer to show the stopping message if the handler is still running after cancellation.SetStartedHandlerto acceptTaskinstead ofTask<int>since BaseCommand now manages the exit code directly.CliExitCodes.CancelledtoCommandResult.Cancelled(exitCode).Refactoring
IFeatures,ICliUpdateNotifier,CliExecutionContext,IInteractionService,AspireCliTelemetry,ConsoleCancellationManager,ILoggerFactory). All commands now take a singleCommonCommandServicesparameter.CancellationManagerproperty so it flows through DI.WhenAnyat the top level since BaseCommand handles it.Test fixes
usingto allBuildServiceProvider()calls in CLI tests to fixFileLoggerProviderholding file handles.ConsoleCancellationManagerregistration to test DI setup.Task.Delay(Timeout.Infinite, ct)withAsyncTestHelpers.WaitForCancellationAsync(ct)for cleaner test code.Testing
All 3829 CLI tests pass (0 failures, 21 skipped).