Fix age-keygen hanging due to pipe buffering

Extract public key from generated file instead of parsing
stderr through a pipe, which could cause blocking.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-14 02:38:13 -05:00
parent 1a87fab2d7
commit 5f7c7a4579

3
setup
View File

@@ -80,8 +80,9 @@ setup_new() {
else else
if has age-keygen; then if has age-keygen; then
step "Generating age encryption key..." step "Generating age encryption key..."
age-keygen -o "$AGE_KEY_FILE" 2>&1 | grep -i "public key" age-keygen -o "$AGE_KEY_FILE" 2>/dev/null
chmod 600 "$AGE_KEY_FILE" chmod 600 "$AGE_KEY_FILE"
grep '^# public key:' "$AGE_KEY_FILE" | sed 's/^# //'
else else
err "age not installed. Run: nix-shell -p age" err "age not installed. Run: nix-shell -p age"
exit 1 exit 1