From e8cd37674169499f281bf6110efd430d2c443887 Mon Sep 17 00:00:00 2001 From: David F Glidden Date: Mon, 27 Jul 2026 22:15:06 +0200 Subject: [PATCH] fix(drift-check): handle SIGPIPE so `| head` does not traceback Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01Xefg5EXwcpd9RMAr63dWrD --- scripts/governance-drift-check.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/governance-drift-check.py b/scripts/governance-drift-check.py index 738fc29..1189d5c 100755 --- a/scripts/governance-drift-check.py +++ b/scripts/governance-drift-check.py @@ -18,11 +18,17 @@ report, not a gate. import json import os import re -import subprocess +import signal import sys from datetime import date from pathlib import Path +# Report cleanly when the reader closes early (`| head`), rather than tracebacking. +try: + signal.signal(signal.SIGPIPE, signal.SIG_DFL) +except (AttributeError, ValueError): # not POSIX, or not on the main thread + pass + HOME = Path.home() CLAUDE_MD = HOME / "dotfiles" / "CLAUDE.md" MONTHS = ("january february march april may june july august september "