Skip to content

Line-buffer stdout so the launchd log is usable - #2

Open
nanderss wants to merge 1 commit into
okoker:mainfrom
nanderss:line-buffered-stdout
Open

Line-buffer stdout so the launchd log is usable#2
nanderss wants to merge 1 commit into
okoker:mainfrom
nanderss:line-buffered-stdout

Conversation

@nanderss

Copy link
Copy Markdown

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:

_ = setvbuf(stdout, nil, _IOLBF, 0)

After this the log populates live and tail -f works as the README describes.

Worth noting for anyone debugging this: output now appears promptly, but there is still a race if you grep the log immediately after launchctl bootstrap — the startup lines take a moment to land. Check for the StreamDeckController running line before drawing conclusions from the log.

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>
@nanderss nanderss mentioned this pull request Aug 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant