chocolatey / chocolatey/choco

Correctly handle SIGINT / Control+C

Open
#619 19 comments 10 reactions 0 assignees View on GitHub
0 - Triaging Customer Enhancement
Dominant language
C#
Stars
11.5k
Forks
960
PR merge metrics
No merged PRs in 30d

Description

Chocolatey currently prints the following hostile message when interrupted with Control+C:

```
Exiting chocolatey abnormally. Please manually clean up anything that was not finished.
Please do not ever use Control+C or close the window to exit.
```

But Control+C is often necessary. For example, for [~~poor~~ various reasons](158), `choco list` still lists every package on chocolatey. If you're on VM, or a slow connection, or in a subnet without internet, an accidental `choco list` can consume substantial time and must be interrupted.

Instead of doing this, why not simply handle the interrupt? On the first Control-C, [Homebrew](https://github.com/Homebrew/homebrew/) will silently begin to stop its tasks. On the second, it prints the message `Just a moment, cleaning up...`. And on the third Control-C, it immediately halts its tasks.

```[tasklist]
### Tasks
- [ ] Handle pressing Ctrl+C while a package is being installed.
- [ ] Handle Ctrl+C while a package is being upgraded.
- [ ] Hand Ctrl+C while a package dependency is being installed to ensure that it doesn't "disappear"
```

### Additional Information
[Zendesk Ticket](https://chocolatey.zendesk.com/agent/tickets/23520)

Contributor guide

Open the contributing guide

Research direction

Start by tracing how Ctrl+C is handled during package installation, upgrades, and dependency installation. Compare the requested first-, second-, and third-interrupt behavior with the current cleanup path. Done means interrupts stop work safely without leaving dependencies or packages in an inconsistent state.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.