Skip to content

Plumb cancellationtokens through all CLI commands for consistent behavior #56331

Description

@baronfel

A good follow-up might be to make async commands more first-class in the .NET CLI / in CommandBase. As far as I can tell, I don't think the synchronous version of ToolExecuteCommand.Execute() is called from anywhere.

Originally posted by @lbussell in #55958 (review)

The Func<ParseResult, CancellationToken, Task<int>> overload of System.CommandLine's SetAction provides the cancellation token, and we can plumb that through every Command we create so that a Ctrl+C/SIGTERM is handled correctly.

Activity

  1. added
    cli-uxIssues and PRs that deal with the UX of the CLI (exit codes, log output, verbs/options, and so on)
    on Sep 17, 2026
  2. added theissue type on Sep 17, 2026
  3. locked and limited conversation to collaborators on Sep 17, 2026
  4. unlocked this conversation on Sep 17, 2026
  5. github-actions commented on Sep 17, 2026

    @github-actions
    Contributor

    🎯 Agentic Issue Triage

    Triage Assessment:

    • 🏷️ Labels: Applied, modified, and already-present relevant labels: Area-CLI enhancement needs team triage Requires a full team discussion cli-ux Issues and PRs that deal with the UX of the CLI (exit codes, log output, verbs/options, and so on)
    • 💻 Assignment: none | @dotnet/dotnet-cli
    • 🟩 Confidence: high - Issue directly names CommandBase/CLI command infrastructure, matching the unambiguous /src/Cli/ CODEOWNERS section.

    Similar issues: #33417 (potentially related)

    ➡️ Summary: Proposes plumbing CancellationToken through all CLI commands via SetAction so Ctrl+C/SIGTERM is handled consistently. This is a cross-cutting design change affecting every command; recommend team discussion before implementation.

    Generated by 🏷️ Issue Triage for #56331 · copilot · auto · 60.4 AIC · ⌖ 8.09 AIC · ⊞ 14.6K · ◷

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

Metadata

Metadata

Labels

Area-CLIcli-uxIssues and PRs that deal with the UX of the CLI (exit codes, log output, verbs/options, and so on)enhancementuntriagedRequest triage from a team member

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions