From 35b880cec19e0b8582c834ab9a1cf11906bad37d Mon Sep 17 00:00:00 2001 From: sban Date: Mon, 4 Sep 2023 18:57:07 -0700 Subject: [PATCH] Added timeout to getforecast to prevent status bar breakage. A 2 second timeout is used in the case that wttr.in is inaccessible when dwm is started; as otherwise it tries to curl wttr.in indefinitely, not allowing other status bar modules to be loaded. --- .local/bin/statusbar/sb-forecast | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.local/bin/statusbar/sb-forecast b/.local/bin/statusbar/sb-forecast index 368c17f7..d8a16aad 100755 --- a/.local/bin/statusbar/sb-forecast +++ b/.local/bin/statusbar/sb-forecast @@ -7,7 +7,7 @@ url="${WTTRURL:-wttr.in}" weatherreport="${XDG_CACHE_HOME:-$HOME/.cache}/weatherreport" # Get a weather report from 'wttr.in' and save it locally. -getforecast() { curl -sf "$url/$LOCATION" > "$weatherreport" || exit 1; } +getforecast() { timeout --signal=1 2s curl -sf "$url/$LOCATION" > "$weatherreport" || exit 1; } # Forecast should be updated only once a day. checkforecast() {