From 67ada0b5bc25cb6cff3ab780d82cb0bfe64e4968 Mon Sep 17 00:00:00 2001 From: Lukasz Kasprzak Date: Mon, 14 Sep 2026 23:58:43 +0200 Subject: tests: apply error exits 1 and w stops krino through the real command; undo projection occupied half --- cmd/krino/sort.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'cmd/krino/sort.go') diff --git a/cmd/krino/sort.go b/cmd/krino/sort.go index 163d388..5a175a4 100644 --- a/cmd/krino/sort.go +++ b/cmd/krino/sort.go @@ -37,6 +37,11 @@ import ( // what go test does with stdin. var stdin = os.Stdin +// stdinIsTerminal is the check that review can prompt at all, a seam so a +// test can drive review through a pipe (tui.ReadKey reads a pipe byte by +// byte). +var stdinIsTerminal = func() bool { return term.IsTerminal(int(stdin.Fd())) } + // zeroOutcome is the per-directory outcome line for a directory that had // nothing applied to it - either because nothing was actionable, or // because the user chose [s] or [q] - so the same wording is not retyped @@ -73,7 +78,7 @@ func cmdSort(g *globals, names []string, stdout, stderr io.Writer) int { // Spec ยง8.4: with neither -y nor -n, krino asks; asking a non-terminal // stdin would just hang (or read garbage), so it refuses instead. - if !g.yes && !g.dry && !term.IsTerminal(int(stdin.Fd())) { + if !g.yes && !g.dry && !stdinIsTerminal() { return usageError(stderr, "refusing to prompt: stdin is not a terminal (use -y or -n)") } -- cgit v1.3