Skip to content

AI agent skill that researches any topic across Reddit, X, YouTube, HN, Polymarket, and the web - then synthesizes a grounded summary

fix(xurl): treat PermissionError from PATH lookup as unavailable (#322)

Ilia Alshanetsky5b87cca886c9
diff --git a/skills/last30days/scripts/lib/xurl_x.py b/skills/last30days/scripts/lib/xurl_x.py
index 994b58c3..c2a60ef8 100644
--- a/skills/last30days/scripts/lib/xurl_x.py
+++ b/skills/last30days/scripts/lib/xurl_x.py
@@ -46,9 +46,10 @@ def is_available() -> bool:
timeout=10,
)
return result.returncode == 0 and '"username"' in result.stdout
- except FileNotFoundError:
- return False
- except subprocess.TimeoutExpired:
+ except (OSError, subprocess.TimeoutExpired):
+ # OSError covers FileNotFoundError (no xurl on PATH) and
+ # PermissionError (a non-executable match on PATH, e.g. WSL's
+ # /mnt/c/.../WindowsApps shim returning EACCES on exec).
return False
diff --git a/tests/test_xurl_x.py b/tests/test_xurl_x.py
index 14bce720..7f79e099 100644
--- a/tests/test_xurl_x.py
+++ b/tests/test_xurl_x.py
@@ -44,6 +44,13 @@ class TestIsAvailable(unittest.TestCase):
with mock.patch("subprocess.run", side_effect=FileNotFoundError):
self.assertFalse(xurl_x.is_available())
+ def test_returns_false_on_permission_error(self):
+ # WSL hits this when a Windows-mounted PATH entry points at an
+ # exec-blocked shim (e.g. WindowsApps), which raises PermissionError
+ # before any other PATH candidate is tried.
+ with mock.patch("subprocess.run", side_effect=PermissionError(13, "Permission denied", "xurl")):
+ self.assertFalse(xurl_x.is_available())
+
def test_returns_false_on_timeout(self):
import subprocess
with mock.patch("subprocess.run", side_effect=subprocess.TimeoutExpired("xurl", 10)):