Fix local executor failing on output lines over 64KiB - #360
Merged
Conversation
Previously, Local.Run split the captured stdout with a default bufio.Scanner, so a command printing a single line longer than 64KiB failed with "bufio.Scanner: token too long" even though the command itself succeeded. The remote executor has no such limit, so the same playbook behaved differently depending on whether it ran locally or over ssh. The buffered output is now split in place, keeping bufio.ScanLines semantics: a trailing CR is dropped and the empty element after the final newline is not returned.
paskal
force-pushed
the
executor-local-long-lines
branch
from
August 19, 2026 16:01
18c826b to
cd4eda8
Compare
umputun
approved these changes
Aug 19, 2026
umputun
left a comment
Owner
There was a problem hiding this comment.
not blocking, merging as is.
the new helper keeps blank lines, while Remote.sshRun (remote.go:361) and Dry.Run (dry.go:30) drop them with if line != "", so the three executor.Interface implementations now return different line shapes for the same stdout. git log -S SplitSeq shows the only commit that touched those loops is 7640456, a mechanical Split -> SplitSeq rewrite, so nothing decided this deliberately.
two ways to go. Leave it and keep per-executor behavior, which costs nothing. Or unify on splitOutputLines so all three return the same shape, which changes Remote output: commands.go:564 joins with "; " and would start picking up empty segments. That would be a separate PR.
This was referenced Aug 19, 2026
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.
Previously,
Local.Runsplit the captured output with a defaultbufio.Scanner, so a command printing a single line longer than 64KiB failed withbufio.Scanner: token too longeven though the command itself had succeeded. The remote executor has no such limit, sinceRemote.sshRunsplits the buffered output withstrings.SplitSeq, so the same playbook behaved differently depending on whether it ran locally or over ssh.On master:
After this change the same playbook completes. The output is fully buffered in memory by the time it is split, so the scanner's bounded reads bought nothing, and splitting the buffer in place returns a line of any length as it is. The splitting keeps
bufio.ScanLinessemantics, dropping a trailing\rand the empty element after the final newline, so nothing changes for existing playbooks;TestSplitOutputLinespins that down case by case.