detached 3b5f32b

test(shellcmd): pin exact stderr truncation length

TestRunnerBoundsStderr used LessOrEqual, which also passes when
StderrLimit silently stops being propagated and stderr is never
captured. Pin the assertion to exactly 64 bytes so the test can
actually fail for the bug it exists to catch.

Also clarify the CommandResult.ExitCode doc comment: -1 covers both
"could not be started" and "terminated by a signal" (the timeout
path SIGKILLs the process group, which also yields -1 from
*exec.ExitError even though the process did run).
commit
3b5f32b8590aaae2fab053305e536458f71cef7d
author
brice · · 2026-07-20 08:05 UTC
parent
456b0b1
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
2 files · +3 -2
M internal/adapters/shellcmd/runner_test.go +1 -1
@@ -166,5 +166,5 @@ func TestRunnerBoundsStderr(t *testing.T) {
166166 StdoutLimit: 1024,
167167 StderrLimit: 64,
168168 })
169- require.LessOrEqual(t, len(res.Stderr), 64)
169+ require.Equal(t, 64, len(res.Stderr), "stderr must be captured and truncated to StderrLimit")
170170 }
@@ -166,5 +166,5 @@ func TestRunnerBoundsStderr(t *testing.T) {
166 StdoutLimit: 1024,166 StdoutLimit: 1024,
167 StderrLimit: 64,167 StderrLimit: 64,
168 })168 })
169- require.LessOrEqual(t, len(res.Stderr), 64)169+ require.Equal(t, 64, len(res.Stderr), "stderr must be captured and truncated to StderrLimit")
170 }170 }
M internal/ports/shell.go +2 -1
@@ -16,7 +16,8 @@ type CommandSpec struct {
1616
1717 // CommandResult carries bounded output and the process exit status. ExitCode is
1818 // 0 when the command ran to completion successfully, the process exit code when
19-// it ran and failed, and -1 when the command could not be run at all.
19+// it ran and failed, and -1 when the command could not be started or was
20+// terminated by a signal.
2021 type CommandResult struct {
2122 Stdout []byte
2223 Stderr []byte
@@ -16,7 +16,8 @@ type CommandSpec struct {
16 16
17 // CommandResult carries bounded output and the process exit status. ExitCode is17 // CommandResult carries bounded output and the process exit status. ExitCode is
18 // 0 when the command ran to completion successfully, the process exit code when18 // 0 when the command ran to completion successfully, the process exit code when
19-// it ran and failed, and -1 when the command could not be run at all.19+// it ran and failed, and -1 when the command could not be started or was
20+// terminated by a signal.
20 type CommandResult struct {21 type CommandResult struct {
21 Stdout []byte22 Stdout []byte
22 Stderr []byte23 Stderr []byte

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 12

Tags 11

↑↓ moveenter openesc close