Skip to content

Fix hang on quit when confirmOnQuit is true - #5919

Merged
stefanhaller merged 4 commits into
masterfrom
fix-confirm-on-quit-error
Aug 12, 2026
Merged

Fix hang on quit when confirmOnQuit is true#5919
stefanhaller merged 4 commits into
masterfrom
fix-confirm-on-quit-error

Conversation

@stefanhaller

Copy link
Copy Markdown
Collaborator

When confirmOnQuit is true, quitting would sometimes hang for three seconds and then print "cannot kill child process". Concretely, this happened whenever the Files panel was focused but there were no changed files (the main view shows "No changed files").

This is a regression in 0.64.0, it worked before.

Fixes #5918.

stefanhaller and others added 4 commits August 12, 2026 11:04
Every caller passes an f that unconditionally returns nil, so f's error
return has never carried anything: the value is dead weight, and it
occupies the one channel the wait itself needs to report that it couldn't
run f at all. Drop it, so that the error the wait returns can only ever
mean that.

Work that can fail hands its error back through a captured variable, the
way the background fetch already hands back four values, which keeps the
two outcomes distinguishable at a call site that has both.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…dAndWait

Right now the function always returns nil, but this will change later in
this branch, so handle errors properly. Without that, the first capture
that assigns env.git would not run, leave env.git nil, and subsequent
code would crash.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Nothing dequeues user events once MainLoop has returned, so a worker
blocked in OnUIThreadAndWait is blocked for good. The assertion records
that; the next commit makes the wait give up instead.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Quitting with confirmOnQuit set hung for three seconds and printed
"cannot kill child process", but only with a clean working tree. Closing
the confirmation pops the context before running its handler, so the
files panel is re-focused and re-renders the main view, and only then
does the handler return ErrQuit. With no changed files that render is a
string task, whose whole body is one hop to the UI thread — a hop that
is never served, because the handler's ErrQuit has meanwhile brought the
main loop down. The task can't finish, so the ViewBufferManager.Close
that follows waits for it until it times out. (With changed files it's a
command task instead, and every blocking point in one of those selects
on the stop channel, so Close gets through.)

A wait for the UI thread now ends when the loop does. That also covers
the command task's own hops, which are stopped only in between them.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@stefanhaller stefanhaller added the bug Something isn't working label Aug 12, 2026
@stefanhaller
stefanhaller merged commit 4b22b84 into master Aug 12, 2026
15 checks passed
@stefanhaller
stefanhaller deleted the fix-confirm-on-quit-error branch August 12, 2026 17:12
tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request Aug 13, 2026
This MR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [jesseduffield/lazygit](https://github.com/jesseduffield/lazygit) | patch | `v0.64.0` → `v0.64.1` |

MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot).

**Proposed changes to behavior should be submitted there as MRs.**

---

### Release Notes

<details>
<summary>jesseduffield/lazygit (jesseduffield/lazygit)</summary>

### [`v0.64.1`](https://github.com/jesseduffield/lazygit/releases/tag/v0.64.1)

[Compare Source](jesseduffield/lazygit@v0.64.0...v0.64.1)

<!-- Release notes generated using configuration in .github/release.yml at v0.64.1 -->

#### What's Changed

This fixes a few regressions that were introduced in the [last release](https://github.com/jesseduffield/lazygit/releases#release-v0.64.0), and some long-standing bugs that I didn't see any reason to hold back until the next big one.

##### Fixes 🔧

- Fix transitions of entering and exiting filtering mode (e.g. by path or author) by [@&#8203;stefanhaller](https://github.com/stefanhaller) in [#&#8203;5897](jesseduffield/lazygit#5897)
- Fix race in "Stash staged changes" on git versions before 2.35.0 by [@&#8203;stefanhaller](https://github.com/stefanhaller) in [#&#8203;5903](jesseduffield/lazygit#5903)
- Fix several problems with repos whose git dir lives outside the working tree by [@&#8203;stefanhaller](https://github.com/stefanhaller) in [#&#8203;5910](jesseduffield/lazygit#5910)
- Update the UI after stash operations in a single frame by [@&#8203;stefanhaller](https://github.com/stefanhaller) in [#&#8203;5905](jesseduffield/lazygit#5905)
- Honor the conflict-marker-size gitattribute by [@&#8203;stefanhaller](https://github.com/stefanhaller) in [#&#8203;5902](jesseduffield/lazygit#5902)
- Fix hang on quit when confirmOnQuit is true by [@&#8203;stefanhaller](https://github.com/stefanhaller) in [#&#8203;5919](jesseduffield/lazygit#5919)
- Fix pull requests silently disappearing until lazygit is restarted by [@&#8203;stefanhaller](https://github.com/stefanhaller) in [#&#8203;5921](jesseduffield/lazygit#5921)

##### Maintenance ⚙️

- Don't let integration tests race a background git repack by [@&#8203;stefanhaller](https://github.com/stefanhaller) in [#&#8203;5898](jesseduffield/lazygit#5898)
- update Nix flake dependencies by [@&#8203;TyceHerrman](https://github.com/TyceHerrman) in [#&#8203;5894](jesseduffield/lazygit#5894)
- Simplify the run\_integration\_tests.sh script by [@&#8203;stefanhaller](https://github.com/stefanhaller) in [#&#8203;5908](jesseduffield/lazygit#5908)
- Bump actions/setup-go from 6 to 7 by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;5843](jesseduffield/lazygit#5843)
- Bump github.com/kyokomi/emoji/v2 from 2.2.13 to 2.2.14 by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;5813](jesseduffield/lazygit#5813)
- Bump mheap/github-action-required-labels from 5.5.2 to 5.6.0 by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;5769](jesseduffield/lazygit#5769)
- Bump github.com/lucasb-eyer/go-colorful from 1.4.0 to 1.4.1 by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;5916](jesseduffield/lazygit#5916)
- Bump JamesIves/github-sponsors-readme-action from 1.6.0 to 1.6.1 by [@&#8203;dependabot](https://github.com/dependabot)\[bot] in [#&#8203;5917](jesseduffield/lazygit#5917)

**Full Changelog**: <jesseduffield/lazygit@v0.64.0...v0.64.1>

</details>

---

### Configuration

📅 **Schedule**: (UTC)

- Branch creation
  - At any time (no schedule defined)
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever MR is behind base branch, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this MR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4yODguMCIsInVwZGF0ZWRJblZlciI6IjQzLjI4OC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJSZW5vdmF0ZSBCb3QiLCJhdXRvbWF0aW9uOmJvdC1hdXRob3JlZCIsImRlcGVuZGVuY3ktdHlwZTo6cGF0Y2giXX0=-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

confirmOnQuit causes brief hang on clean tree

1 participant