[llvm] [lit] Use text mode when opening text files on z/OS (PR #217434)
Abhina Sree via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 21 06:08:01 PDT 2026
================
@@ -90,9 +90,19 @@ def run(argv, stdin, stdout, stderr, cwd):
if show_nonprinting:
contents = convertToCaretAndMNotation(contents)
- elif is_text:
- contents = contents.encode()
+
+ # Determine if stdout expects text or binary
+ mode = getattr(stdout, "mode", "b")
+ is_text_output = "b" not in mode
+
+ if is_text_output:
+ if isinstance(contents, bytes):
+ contents = contents.decode()
+ else:
+ if isinstance(contents, str):
+ contents = contents.encode()
stdout.write(contents)
+
----------------
abhina-sree wrote:
thanks, fixed
https://github.com/llvm/llvm-project/pull/217434
More information about the llvm-commits
mailing list