secret get fails when it cannot write the value (closes #155)
check / check (push) Canceled after 0s

GetSecret and GetSecretWithVersion discarded the result of writing the
value to stdout, so a full disk or a failing stdout left the caller with
an empty or cut-short file and exit status 0. The write error is now
returned, so the command prints it and exits 1.

Deviation: a stdout the shell closed before `secret` started still exits
0, because the Go runtime opens /dev/null in its place and the write
there succeeds.

Model: opus-5-5
This commit is contained in:
2026-10-14 20:33:37 +00:00
parent fe94e99801
commit 81ffe12c84
4 changed files with 59 additions and 3 deletions
+8
View File
@@ -18,6 +18,14 @@ https://git.eeqj.de/sneak/secret/milestone/12
# Completed Steps
- 2026-10-14: `secret get` fails when it cannot write the value to stdout
(https://git.eeqj.de/sneak/secret/issues/155). The write's error was ignored,
so a script that sent the value to a file on a full disk saw `secret get`
succeed and was left with an empty or cut-short file. That error is now the
command's error, and `secret get` exits 1. A stdout the shell closed (`>&-`)
still gives exit 0, because the Go runtime opens `/dev/null` in its place
before `secret` starts and the write there succeeds.
- 2026-10-14: `secret generate mnemonic`, `secret vault list` and
`secret unlocker list` print their output to stdout, as `secret list` does, so
it can be piped or captured (https://git.eeqj.de/sneak/secret/issues/138).