Repository navigation
fix(cli): abort config wizard cleanly when a selection is cancelled - #1473
Merged
Merged
Conversation
benoit-cty
force-pushed
the
fix-cli-cancel-prompt
branch
from
November 1, 2026 13:43
cdf29a2 to
b15d338
Compare
benoit-cty
approved these changes
Nov 1, 2026
benoit-cty
left a comment
Contributor
There was a problem hiding this comment.
Thanks for reporting and fixing this.
I hope your HacktoberFest goes well !
benoit-cty
enabled auto-merge
November 1, 2026 13:45
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1473 +/- ##
=======================================
Coverage 93.66% 93.67%
=======================================
Files 50 50
Lines 5591 5593 +2
=======================================
+ Hits 5237 5239 +2
Misses 354 354 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Description
questionary_promptnow raisestyper.Abort()when the selection isNone, so thecodecarbon configwizard exits cleanly with "Aborted." when the user cancels, like the other Typer prompts do.Related Issue
No existing issue; found while trying the CLI during Hacktoberfest Hack Day Panama City.
Motivation and Context
In
codecarbon config, pressing Ctrl+C on a selection menu makesquestionaryreturnNone. The wizard keeps going and crashes withError: list index out of range. On the first menu ("Use existing global config…"), cancelling silently creates a new config file instead of stopping.How Has This Been Tested?
questionary.select(...).ask()(returnsNone) throughCliRunner: before the fix →IndexError; after → "Aborted." with exit code 1.test_questionary_prompt_aborts_when_cancelledintests/cli/test_cli.py.pytest tests/cli/→ all tests pass.ruff format --checkpasses on the changed files.Types of changes
AI Usage Disclosure
Checklist: