From 180accd0a4dde00a25c1766c6b962809998d2ad7 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Tue, 15 Sep 2026 12:17:58 +0200 Subject: fix(desktop): keep statusctl quiet when the mode file is absent read_mode() failed on a missing mode file with a shell redirection error, 'statusctl: line 56: .../status.dnd: No such file or directory', printed to stderr on every get/toggle before the file existed and polluting waybar's exec stderr. The '2>/dev/null' sat on the 'tr' command, but the error is the parent shell's input redirection failure, which that redirect cannot suppress. Guard on '[[ -e "$file" ]]' before reading; a missing file still reads as 0, which was always the contract. Mirror the fix into the plan so plan and script agree. --- docs/superpowers/plans/2026-09-15-status-registry.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'docs/superpowers/plans') 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' } -- cgit v1.2.3