fix(build): the PC stays awake while a build runs #174

Merged
HumanBean merged 1 commit from madebyjordan/LongshotLauncher:fix/build-keeps-pc-awake into main 2026-11-17 16:00:21 +00:00
Member

A build takes 15 to 30 minutes, hours on a first cold one, and nothing kept the PC from sleeping at its idle timeout, which stops the build half way. Now the PC stays awake while a build runs.

What changes

  • The Build page holds the PC awake from the moment its build starts until it ends, however it ends (finished, failed, stopped, cancelled): every change of its running state goes through SetRunning.
  • Core/KeepAwake counts holds and takes the platform's once:
    • Windows: a thread of its own holds ES_SYSTEM_REQUIRED and lets go on the same thread (the state is a thread's). The display may still turn off; only sleep is held off.
    • Linux and the Steam Deck: systemd-inhibit --what=sleep:idle, holding the lock on cat reading the launcher's end of a pipe, so the lock goes with the launcher even if it crashes. Nothing is held without systemd-inhibit.
    • A hold that fails never stops a build.

Testing

Windows 11, .NET SDK 10.0.404.

  • python -I tests/test_launcher_core.py with TEMP on its long path: main 1439 checks, this branch 1448. KeepAwakeChecks covers the counting against a stand-in backend (one platform hold for two holds, let go at the last, a hold disposed twice, a failing or missing backend) and the Build page sending every running change through SetRunning. Taking the hold out of SetRunning fails SetRunning does not hold the PC awake while a build runs and let it go after. This is a new behaviour rather than a regression, so there is no check commit that fails on main for a bug's reason.
  • dotnet build: 0 errors, 0 warnings.

Not tested: a real build past the idle timeout on either system, and powercfg /requests showing the hold (Windows) or systemd-inhibit --list (Linux) during one.

🤖 Generated with Claude Code

A build takes 15 to 30 minutes, hours on a first cold one, and nothing kept the PC from sleeping at its idle timeout, which stops the build half way. Now the PC stays awake while a build runs. ## What changes - **The Build page** holds the PC awake from the moment its build starts until it ends, however it ends (finished, failed, stopped, cancelled): every change of its running state goes through `SetRunning`. - **`Core/KeepAwake`** counts holds and takes the platform's once: - Windows: a thread of its own holds `ES_SYSTEM_REQUIRED` and lets go on the same thread (the state is a thread's). The display may still turn off; only sleep is held off. - Linux and the Steam Deck: `systemd-inhibit --what=sleep:idle`, holding the lock on `cat` reading the launcher's end of a pipe, so the lock goes with the launcher even if it crashes. Nothing is held without systemd-inhibit. - A hold that fails never stops a build. ## Testing Windows 11, .NET SDK 10.0.404. - `python -I tests/test_launcher_core.py` with TEMP on its long path: main 1439 checks, this branch 1448. `KeepAwakeChecks` covers the counting against a stand-in backend (one platform hold for two holds, let go at the last, a hold disposed twice, a failing or missing backend) and the Build page sending every running change through `SetRunning`. Taking the hold out of `SetRunning` fails `SetRunning does not hold the PC awake while a build runs and let it go after.` This is a new behaviour rather than a regression, so there is no check commit that fails on main for a bug's reason. - `dotnet build`: 0 errors, 0 warnings. Not tested: a real build past the idle timeout on either system, and `powercfg /requests` showing the hold (Windows) or `systemd-inhibit --list` (Linux) during one. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
fix(build): the PC stays awake while a build runs
All checks were successful
CI / Compile and test (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 3s
ff3cde711c
A build takes 15 to 30 minutes, hours on a first cold one, and nothing
kept the PC from sleeping at its idle timeout, which stops the build half
way. Now the Build page holds the PC awake from the moment its build
starts until it ends, however it ends (finished, failed, stopped,
cancelled): every change of its running state goes through SetRunning.

Core/KeepAwake counts holds and takes the platform's once:
- Windows: a thread of its own holds ES_SYSTEM_REQUIRED and lets go on
  the same thread (the state is a thread's). The display may still turn
  off; only sleep is held off.
- Linux and the Steam Deck: systemd-inhibit (sleep and idle) holding the
  lock on cat reading the launcher's end of a pipe, so the lock goes
  with the launcher even if it crashes. Nothing held without it.
A hold that fails never stops a build.

KeepAwakeChecks: the counting against a stand-in backend (one platform
hold for two holds, let go at the last, twice-disposed harmless, a
failing or missing backend), and the Build page's every running change
going through SetRunning.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
HumanBean deleted branch fix/build-keeps-pc-awake 2026-11-17 16:00:22 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MagicBeanDev/LongshotLauncher!174
No description provided.