I've started using hunk with lazygit on macOS, configuring it via
~/.config/git/config
[core]
pager = hunk pager
and ~/.config/lazygit/config.yml
git:
autoFetch: false
pagers:
- pager: hunk pager
and I'm encountering zombie less processes spinning at 100% CPU after viewing diffs.
I'm not sure this is directly an issue with hunk, but I'm reporting it here in case anyone else sees the same, and this report helps them.
--
Here's the root cause, at least according to Claude:
lazygit closes PTY masters without killing child processes, leaving less in a 100% CPU busy loop.
The chain of events:
1. lazygit allocates a PTY pair for each git command it runs internally
2. git invokes hunk pager (via core.pager), which spawns less -R on the PTY slave
3. When you navigate to a different commit (j/k), lazygit allocates a new PTY for the new
command and closes the old PTY master
4. The old less process still holds the orphaned PTY slave (/dev/ttys005)
5. read() on a PTY slave with no master returns immediately (EIO)
6. Less's command loop treats this as a transient interrupt and retries → tight busy loop
at 100% CPU
it also claims:
hunk spawns less even when TERM=dumb, where less can't do anything useful anyway (lazygit sets TERM=dumb for its subprocesses)
I'm not sure if this last part is true, or even something hunk should be in charge of, but maybe its relevant.
I'll update here when I figure out a workaround.
I've started using hunk with lazygit on macOS, configuring it via
~/.config/git/config
[core] pager = hunk pagerand ~/.config/lazygit/config.yml
and I'm encountering zombie
lessprocesses spinning at 100% CPU after viewing diffs.I'm not sure this is directly an issue with
hunk, but I'm reporting it here in case anyone else sees the same, and this report helps them.--
Here's the root cause, at least according to Claude:
it also claims:
I'm not sure if this last part is true, or even something hunk should be in charge of, but maybe its relevant.
I'll update here when I figure out a workaround.