[llvm] [lit] Add readfile substitution (PR #158441)
James Henderson via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 18 02:04:00 PDT 2025
================
@@ -729,8 +729,11 @@ def _replaceReadFile(match):
filePath = match.group(1)
if not os.path.isabs(filePath):
filePath = os.path.join(cwd, filePath)
- with open(filePath) as fileHandle:
- return fileHandle.read()
+ try:
+ with open(filePath) as fileHandle:
+ return fileHandle.read()
+ except FileNotFoundError:
+ raise InternalShellError(cmd, "File does not exist: %s" % filePath)
----------------
jh7370 wrote:
Perhaps worth mentioning "readfile" in this error message, to help identify the problem?
https://github.com/llvm/llvm-project/pull/158441
More information about the llvm-commits
mailing list