From 25881caa9baca7980dda530e27b6025bcf4e8c4a Mon Sep 17 00:00:00 2001
From: Tristan Partin <tristan@partin.io>
Date: Wed, 17 Jun 2026 19:09:29 +0000
Subject: [PATCH v1 3/7] Remove the shutil.which() call

This call is pointless. We were resolving `killall` to a filesystem
path, and immediately discarding it just to re-resolve it again in the
subsequent run() call. This is not a pythonic was to write this code.
Instead, we can wrap the function call with a try/except block and just
ignore any exception that may arise.

Signed-off-by: Tristan Partin <tristan@partin.io>
---
 src/tools/ci/gha_ccache_decide.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/tools/ci/gha_ccache_decide.py b/src/tools/ci/gha_ccache_decide.py
index b4874517fb..4b322b8087 100644
--- a/src/tools/ci/gha_ccache_decide.py
+++ b/src/tools/ci/gha_ccache_decide.py
@@ -2,7 +2,6 @@
 
 import json
 import os
-import shutil
 import subprocess
 
 def run(cmd, check=True):
@@ -79,8 +78,10 @@ def main():
     # Before continuing, try to kill all ccache instances, otherwise
     # it's possible that on cancellations there is still running
     # ccaches that cause the upload to fail.
-    if shutil.which("killall"):
+    try:
         print(run(["killall", "ccache"], check=False))
+    except FileNotFoundError:
+        pass
 
     return 0
 
-- 
Tristan Partin
https://tristan.partin.io

