Skip to content

Unify command output line splitting across executors - #362

Merged
umputun merged 1 commit into
umputun:masterfrom
paskal:executor-unify-output-lines
Aug 19, 2026
Merged

Unify command output line splitting across executors#362
umputun merged 1 commit into
umputun:masterfrom
paskal:executor-unify-output-lines

Conversation

@paskal

@paskal paskal commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #360, where you pointed out that the three executor.Interface implementations return different line shapes for the same stdout.

Remote.sshRun and Dry.Run now use the same splitOutputLines helper as Local.Run, and the helper moves from local.go to executor.go since all three share it. Any executor now returns the same slice for the same output: interior blank lines kept, a trailing \r dropped, no empty element after the final newline.

The consequence you named, Echo joining with "; " and picking up empty segments, is handled where it belongs. commands.go skips empty lines when building the report, so the echo detail line is unchanged for remote commands; whitespace-only lines are still reported, only empty ones are dropped. That case was already reachable through the local executor before #360, since bufio.ScanLines kept interior blank lines there too, so the filter fixes it on both paths.

Tests: Remote gains a blank-line and CRLF case, Dry a multi-line case, and Echo blank-line and whitespace-only cases. TestSplitOutputLines moves next to the helper.

If you would rather keep per-executor behaviour, close this and nothing is lost.

@paskal
paskal requested a review from umputun as a code owner August 19, 2026 18:14
@paskal
paskal force-pushed the executor-unify-output-lines branch from bcfe7b4 to ce4f337 Compare August 19, 2026 18:58
Remote.sshRun and Dry.Run dropped every empty line and kept a trailing
CR, while Local.Run kept blank lines and trimmed the CR, so the same
stdout produced different slices depending on the implementation. All
three now share splitOutputLines, moved from local.go to executor.go.

Echo skips empty lines when joining the output for the report, so the
reported detail stays as it was for remote commands and no longer shows
empty segments for local ones. Whitespace-only lines are still reported.
@paskal
paskal force-pushed the executor-unify-output-lines branch from ce4f337 to 3dbe71a Compare August 19, 2026 19:01
@umputun
umputun merged commit 7c05bf5 into umputun:master Aug 19, 2026
1 check passed
umputun added a commit that referenced this pull request Aug 19, 2026
pkg/executor starts docker containers through testcontainers and takes ~94s
locally, leaving almost no headroom under the 100s per-package cap. The
executor test cases added in #362 pushed it past the limit and master timed
out.
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.

2 participants