Skip to content

fix: run spinner onCancel on Ctrl+C#581

Open
cyphercodes wants to merge 1 commit into
bombshell-dev:mainfrom
cyphercodes:fix-spinner-oncancel-ctrl-c
Open

fix: run spinner onCancel on Ctrl+C#581
cyphercodes wants to merge 1 commit into
bombshell-dev:mainfrom
cyphercodes:fix-spinner-oncancel-ctrl-c

Conversation

@cyphercodes

Copy link
Copy Markdown

What does this PR do?

Fixes spinner cancellation from Ctrl+C when the keypress is handled by the blocked input path. The spinner now treats the blocked-input exit path as cancellation, passes the configured input stream to block(), runs onCancel, and sets isCancelled.

Closes #573

Type of change

  • Bug fix
  • Feature
  • Refactor (no behavior change)
  • Documentation
  • Performance improvement
  • Tests
  • Chore (dependencies, CI, tooling)

Checklist

  • pnpm test passes (or targeted tests for my change)
  • pnpm format has been run
  • I have added/updated tests for my changes (if applicable)
  • I have added a changeset

AI-generated code disclosure

  • This PR includes AI-generated code

@github-actions github-actions Bot added the automated PR author detected as automated label Jul 1, 2026
@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Automation signals

@cyphercodes Activity patterns show signs of automation.

Classification: automation (score: 29)

Signal Points Detail
Multiple forks +26 7 repositories forked in a single 24-hour window
Distributed PR spam pattern +45 52 PRs spread across 51 different repositories (22.8 PRs/week)

Analyzed 200 public events via @unveil/identity

@changeset-bot

changeset-bot Bot commented Jul 1, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: fa6509f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@clack/prompts Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Comment on lines +314 to +315
return undefined as never;
}) as typeof process.exit);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These type assertions don't give me confidence

@43081j

43081j commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

this isn't quite right. non-zero exits are not necessarily cancellations.

i think this needs discussion in an issue before a PR is made.

basically, we exit(0) by design when someone cancels:

if (isActionKey([str, name, sequence], 'cancel')) {
if (hideCursor) output.write(cursor.show);
process.exit(0);
return;
}

so there's a discussion needed of if we want to continue doing that, or if we want to exit(1).

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

Labels

automated PR author detected as automated

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Spinner does not run onCancel function on Ctrl + C

3 participants