[llvm] [lit][bazel] Fall back to a default PATHEXT when the variable is unset (PR #217416)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 19 17:55:04 PDT 2026
https://github.com/UebelAndre updated https://github.com/llvm/llvm-project/pull/217416
>From d42e8db3e92682235bd4ff1ec4aac5b11f736c6b Mon Sep 17 00:00:00 2001
From: UebelAndre <github at uebelandre.com>
Date: Wed, 19 Aug 2026 11:00:14 -0700
Subject: [PATCH] [lit][bazel] Fall back to a default PATHEXT when the variable
is unset
---
llvm/utils/lit/lit/util.py | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/llvm/utils/lit/lit/util.py b/llvm/utils/lit/lit/util.py
index 8ab109fe15d45..6596c1d12dd84 100644
--- a/llvm/utils/lit/lit/util.py
+++ b/llvm/utils/lit/lit/util.py
@@ -130,7 +130,11 @@ def which(command, paths=None):
# Get suffixes to search.
# On Cygwin, 'PATHEXT' may exist but it should not be used.
if os.pathsep == ";":
- pathext = os.environ.get("PATHEXT", "").split(";")
+ # If PATHEXT was stripped from the environment then use
+ # a sane fallback so binaries can still be located.
+ fallback = ".COM;.EXE;.BAT;.CMD"
+
+ pathext = os.environ.get("PATHEXT", fallback).split(";")
else:
pathext = [""]
More information about the llvm-commits
mailing list