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 21:05:20 +00:00
parent 46c395e045
commit d967f894eb
4 changed files with 63 additions and 3 deletions
+7
View File
@@ -18,6 +18,13 @@ 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: The passphrase and mnemonic prompts ask on the controlling
terminal (`/dev/tty`) instead of stdin, so `echo v | secret add s1 --force`,
`cat file | secret encrypt key` and `cat file.age | secret decrypt key` ask