Line-buffer stdout so the launchd log is usable - #2
Open
nanderss wants to merge 1 commit into
Open
Conversation
print() is block buffered when stdout is a file rather than a tty, and the daemon never exits to flush it. Under the LaunchAgent this leaves ~/Library/Logs/StreamDeckController.log at zero bytes indefinitely, so the startup config dump, the device state and every warning are invisible for the entire life of the process. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
print()is block buffered when stdout is a file rather than a tty. Under the LaunchAgent, stdout is redirected to~/Library/Logs/StreamDeckController.log, and the daemon never exits to flush it — so the log sits at zero bytes indefinitely while the process runs normally.That hides the startup config dump, the device connect/disconnect lines and every warning, for the entire life of the process. In my case the log was empty for 16 days while the daemon was running and healthy, which reads as "the daemon isn't working" rather than "the output is buffered".
One line in
main.swift:After this the log populates live and
tail -fworks as the README describes.Worth noting for anyone debugging this: output now appears promptly, but there is still a race if you
grepthe log immediately afterlaunchctl bootstrap— the startup lines take a moment to land. Check for theStreamDeckController runningline before drawing conclusions from the log.