diff options
Diffstat (limited to 'docs/superpowers/plans')
| -rw-r--r-- | docs/superpowers/plans/2026-09-15-status-registry.md | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/docs/superpowers/plans/2026-09-15-status-registry.md b/docs/superpowers/plans/2026-09-15-status-registry.md index 5f86de4..614952c 100644 --- a/docs/superpowers/plans/2026-09-15-status-registry.md +++ b/docs/superpowers/plans/2026-09-15-status-registry.md @@ -390,12 +390,12 @@ esac file="$DIR/status.$mode" read_mode() { - local v - # An unreadable file reads as off, deliberately: a missing mode file is - # the normal state before anything has written one, and the redirect - # makes that fallback explicit rather than a side effect of a pipeline - # swallowing cat's exit status. - v="$(tr -d '[:space:]' < "$file" 2>/dev/null)" + local v="" + # A missing file is the normal state before anything has written one and + # reads as off. Guarding on existence keeps the shell's redirection error + # off stderr: `2>/dev/null` on the command cannot suppress a failure of + # its own input redirect. + [[ -e "$file" ]] && v="$(tr -d '[:space:]' < "$file" 2>/dev/null)" [[ "$v" == "1" ]] && printf '1' || printf '0' } |
