[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 11:02:30 PDT 2026
https://github.com/UebelAndre created https://github.com/llvm/llvm-project/pull/217416
When running tests on Windows with Bazel, we can enter a scenario where `PATHEXT` is stripped from the environment before python starts, resulting in binaries not being found. This change adds a common fallback in the event `PATHEXT` is ever undefined or set to an empty value.
>From 2a6de37cab23101cb9ccbc62555d666c9d6c72d4 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 | 2 ++
1 file changed, 2 insertions(+)
diff --git a/llvm/utils/lit/lit/util.py b/llvm/utils/lit/lit/util.py
index 8ab109fe15d45..6bd435e4e74dc 100644
--- a/llvm/utils/lit/lit/util.py
+++ b/llvm/utils/lit/lit/util.py
@@ -131,6 +131,8 @@ def which(command, paths=None):
# On Cygwin, 'PATHEXT' may exist but it should not be used.
if os.pathsep == ";":
pathext = os.environ.get("PATHEXT", "").split(";")
+ if not any(pathext):
+ pathext = [".COM", ".EXE", ".BAT", ".CMD"]
else:
pathext = [""]
More information about the llvm-commits
mailing list