[llvm] [lit] Add readfile substitution (PR #158441)
James Henderson via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 15 03:11:21 PDT 2025
================
@@ -720,6 +720,23 @@ def processRedirects(cmd, stdin_source, cmd_shenv, opened_files):
return std_fds
+def _expandLateSubstitutions(arguments, cwd):
+ for i, arg in enumerate(arguments):
+ if not isinstance(arg, str):
+ continue
+
+ def _replaceReadFile(match):
+ filePath = match.group(1)
+ if not os.path.isabs(filePath):
+ filePath = os.path.join(cwd, filePath)
+ with open(filePath) as fileHandle:
----------------
jh7370 wrote:
That wouldn't be very pythonic. `try`/`except` would be more idiomatic, if we want a more graceful failure.
https://github.com/llvm/llvm-project/pull/158441
More information about the llvm-commits
mailing list