[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:56:58 PDT 2026
https://github.com/UebelAndre updated https://github.com/llvm/llvm-project/pull/217416
>From 146c74eb996729e9b38499c989dfa0a259d2db6e 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 | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/llvm/utils/lit/lit/util.py b/llvm/utils/lit/lit/util.py
index 8ab109fe15d45..a1f8457395d84 100644
--- a/llvm/utils/lit/lit/util.py
+++ b/llvm/utils/lit/lit/util.py
@@ -130,7 +130,12 @@ 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 (e.g. when
+ # running with a hermetic build system like Bazel) 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