From 272c5732b0bc932749f0e771de51ee49f6cebe5b Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Tue, 29 Sep 2026 11:14:08 +0200 Subject: fix(calendar): drop the cache when khal is missing With khal uninstalled the sampler still wrote a cache with a generated key and no events, because khal's stderr is discarded. The card then read "nothing this week" while an event was scheduled. Removing the cache instead shows the card's "no calendar data" face. Co-Authored-By: Claude Opus 5.5 --- bin/calendar-sample.sh | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'bin/calendar-sample.sh') diff --git a/bin/calendar-sample.sh b/bin/calendar-sample.sh index 1937cf6..af583f6 100755 --- a/bin/calendar-sample.sh +++ b/bin/calendar-sample.sh @@ -13,6 +13,14 @@ CACHE="$CACHE_DIR/calendar.txt" umask 077 mkdir -p "$CACHE_DIR" +# Without khal the list below fails silently (its stderr is discarded), and the +# cache would claim an empty week. Removing the cache instead makes the card +# show its "no calendar data" face, which is the truth. +if ! command -v khal >/dev/null 2>&1; then + rm -f "$CACHE" + exit 1 +fi + TMP="$CACHE.tmp.$$" trap 'rm -f "$TMP"' EXIT -- cgit v1.2.3