fix(xurl): treat PermissionError from PATH lookup as unavailable (#322)
is_available() only caught FileNotFoundError and TimeoutExpired. On WSL, a /mnt/c/.../WindowsApps entry on $PATH returns EACCES during exec, and Python raises PermissionError. That escaped is_available() and crashed pipeline.diagnose() before any source ran. Catch OSError instead. It covers FileNotFoundError, PermissionError, and any other spawn-time OS error, so a non-executable xurl on PATH falls through to the next backend instead of aborting the run.
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user