Silence jq noise when the reload guard probes dead Hyprland instances

hyprctl prints "Couldn't connect ..." on stdout for stale instance dirs
left in /run/user/*/hypr/, so jq's parse error leaked into pacman's
pre-transaction hook output. The dead instances were already skipped
correctly; only the stderr noise escaped.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ls3ump7hcv4oNnjWW5AXmn
This commit is contained in:
David Heinemeier Hansson
2026-08-01 22:12:01 -05:00
co-authored by Claude Fable 5
parent 9ca5f63f86
commit abe5b1ff9f
2 changed files with 15 additions and 3 deletions
+12 -2
View File
@@ -14,7 +14,9 @@ fake_hyprctl="$test_tmp/hyprctl"
signature="test-signature"
runtime_dir="$run_root/1000"
mkdir -p "$runtime_dir/hypr/$signature"
dead_signature="dead-signature"
mkdir -p "$runtime_dir/hypr/$signature" "$runtime_dir/hypr/$dead_signature"
cat >"$fake_hyprctl" <<'BASH'
#!/bin/bash
@@ -22,6 +24,10 @@ cat >"$fake_hyprctl" <<'BASH'
printf '%s\t%s\n' "$XDG_RUNTIME_DIR" "$*" >>"$FAKE_HYPRCTL_LOG"
case "$*" in
*'--instance dead-signature '*)
printf "Couldn't connect to %s/hypr/dead-signature/.socket.sock. (4)\n" "$XDG_RUNTIME_DIR"
exit 4
;;
*'getoption misc.disable_autoreload'*)
printf '{"option":"misc.disable_autoreload","bool":%s,"set":true}\n' "${FAKE_DISABLE_AUTORELOAD:-false}"
;;
@@ -39,7 +45,7 @@ FAKE_HYPRCTL_LOG="$hyprctl_log" \
HYPRCTL="$fake_hyprctl" \
OMARCHY_HYPRLAND_RELOAD_GUARD_RUN_ROOT="$run_root" \
OMARCHY_HYPRLAND_RELOAD_GUARD_STATE_DIR="$state_dir" \
"$ROOT/bin/omarchy-hyprland-reload-guard" pause
"$ROOT/bin/omarchy-hyprland-reload-guard" pause 2>"$test_tmp/pause-stderr"
state_file="$state_dir/$signature"
[[ -f $state_file ]] || fail "reload guard stores Hyprland state on pause"
@@ -48,6 +54,10 @@ grep -Fx "$expected_state" "$state_file" >/dev/null || fail "reload guard record
grep -F 'hl.config({ misc = { disable_autoreload = true }, debug = { suppress_errors = true } })' "$hyprctl_log" >/dev/null || fail "reload guard pauses autoreload with hyprctl eval"
pass "reload guard pauses live Hyprland reloads"
[[ ! -e $state_dir/$dead_signature ]] || fail "reload guard skips instances hyprctl cannot reach"
[[ ! -s $test_tmp/pause-stderr ]] || fail "reload guard pauses dead Hyprland instances quietly" "$(cat "$test_tmp/pause-stderr")"
pass "reload guard skips dead Hyprland instances quietly"
: >"$hyprctl_log"
FAKE_HYPRCTL_LOG="$hyprctl_log" \
HYPRCTL="$fake_hyprctl" \