You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Reap leaked caffeinate inhibitors on startup
The display-sleep inhibitor (caffeinate -d -w <pid>) is spawned while a window
is mirrored. A hot-restart (`reminal restart`, syscall.Exec) keeps the same PID
but never runs the stop funcs, so the old image's caffeinate children survive —
their `-w <pid>` still points at the (same-PID) new image — and pile up across
restarts, silently pinning the host display awake (never idle-locks). Combined
with the pre-v1.4.2 winAwake leak this could leave dozens of orphaned
inhibitors.
keepawake.ReapOrphans(), called once at startup before Start()/StartDisplay(),
kills any `caffeinate -w <our-pid>` left over — which at startup are all from a
previous incarnation. This both prevents accumulation and auto-cleans an older
leaky build's mess on the next `restart --all` after upgrading. Orphans of a
genuinely-exited PID already self-terminate via `-w`, so it only matches our own
live PID; macOS only.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>