diff options
| author | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-09-14 23:58:43 +0200 |
|---|---|---|
| committer | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-09-14 23:58:43 +0200 |
| commit | 67ada0b5bc25cb6cff3ab780d82cb0bfe64e4968 (patch) | |
| tree | e05598d93c71af19be946b3cb0d4e80688596c24 /cmd/krino/sort.go | |
| parent | 04f46bf180cf506ceadb76b5afacf9c02700cc65 (diff) | |
| download | krino-67ada0b5bc25cb6cff3ab780d82cb0bfe64e4968.tar.gz krino-67ada0b5bc25cb6cff3ab780d82cb0bfe64e4968.zip | |
tests: apply error exits 1 and w stops krino through the real command; undo projection occupied half
Diffstat (limited to 'cmd/krino/sort.go')
| -rw-r--r-- | cmd/krino/sort.go | 7 |
1 files changed, 6 insertions, 1 deletions
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)") } |
