Skip to content

[Bug] Prevent hard process exit on Ctrl+C if an onCancel callback is passed to spinner#587

Open
kajoseph wants to merge 2 commits into
bombshell-dev:mainfrom
kajoseph:spinnerSoftCancel
Open

[Bug] Prevent hard process exit on Ctrl+C if an onCancel callback is passed to spinner#587
kajoseph wants to merge 2 commits into
bombshell-dev:mainfrom
kajoseph:spinnerSoftCancel

Conversation

@kajoseph

@kajoseph kajoseph commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

With the spinner running, Ctrl+C hard-exits the node process with a buried process.exit(0) as noted by @43081j here. This short-circuits the spinner stop cycle which prevents the onCancel callback from running and also potentially leaves dangling connections to other services (e.g. a database).

This PR changes the behavior slightly so that an onCancel callback will prevent the cancellation cycle from calling process.exit() and instead return control back to the program so that it can cleanly teardown connections or otherwise proceed as desired. This modified behavior is more in-line with the rest of the prompts in that a Ctrl+C returns control back to the program instead of treating it as a SIGINT.

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*

* only the added test cases were generated with AI as I'm not as familiar with this test harness. Suggest verifying that it's testing properly.

@pkg-pr-new

pkg-pr-new Bot commented Jul 24, 2026

Copy link
Copy Markdown

commit: 55afdd5

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant