summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/utils/lit/lit/util.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/utils/lit/lit/util.py b/llvm/utils/lit/lit/util.py
index 8d4d9d25b19..e20c4ab9015 100644
--- a/llvm/utils/lit/lit/util.py
+++ b/llvm/utils/lit/lit/util.py
@@ -193,6 +193,10 @@ def which(command, paths=None):
if paths is None:
paths = os.environ.get('PATH', '')
+ # Check for absolute match first.
+ if os.path.isabs(command) and os.path.isfile(command):
+ return os.path.normpath(command)
+
# Would be nice if Python had a lib function for this.
if not paths:
paths = os.defpath
OpenPOWER on IntegriCloud