Repository navigation
Include an inhibitor helper's stderr when it exits immediately [patch] - #40
Merged
Merged
Conversation
ChildProcessHold drained the helper's stderr into a no-op handler, so a helper that failed during the startup grace period was reported only by exit code. Keep the last 4 KB of stderr while the helper starts, wait for the streams to finish after it exits, and add what it wrote to the SleepBlockException message. Recording stops once startup succeeds. Fixes #15 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017vfJW4SLyvTvUJUdcrUu7F
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Fixes #15
What changed
ChildProcessHold.Startsent the helper's stderr to a no-op handler. A helper that failed during the 250 ms startup grace period (for examplegnome-session-inhibitwith no GNOME session manager, or a polkit denial forsystemd-inhibit) was reported only asexited immediately with code N.StartupErrorOutput). It keeps the last 4 KB, counting the joining spaces, and drops the oldest lines first, since the final lines usually give the reason.WaitForExit()now runs as well. This makes sure the async stderr reader has delivered its last lines before the message is built. The message becomes… exited immediately with code 1. It reported: <stderr>. If the helper wrote nothing, the message is unchanged.Tests
Start_WhenTheHelperExitsImmediately_IncludesItsStandardErrorInTheMessageruns/bin/sh -c "echo boom >&2; exit 1"and checks forboom(this is the issue's acceptance case).Start_WhenTheHelperFloodsStandardError_KeepsOnlyTheLastOfItInTheMessagewrites about 9 KB of filler and then the reason. It checks that the reason is kept, the oldest output is dropped, and the message stays bounded.ChildProcessHoldtests.Generated by Claude Code