[libcxx-commits] [libcxx] [llvm] [LIT] remove `to_unicode`, `to_string`, and `to_bytes` helpers (PR #165950)

Alexander Richardson via libcxx-commits libcxx-commits at lists.llvm.org
Tue Nov 4 07:20:00 PST 2025


================
@@ -391,18 +390,14 @@ def executeBuiltinEcho(cmd, shenv):
     # Some tests have un-redirected echo commands to help debug test failures.
     # Buffer our output and return it to the caller.
     is_redirected = True
-    encode = lambda x: x
     if stdout == subprocess.PIPE:
         is_redirected = False
         stdout = StringIO()
     elif kIsWindows:
-        # Reopen stdout in binary mode to avoid CRLF translation. The versions
-        # of echo we are replacing on Windows all emit plain LF, and the LLVM
-        # tests now depend on this.
-        # When we open as binary, however, this also means that we have to write
-        # 'bytes' objects to stdout instead of 'str' objects.
-        encode = lit.util.to_bytes
-        stdout = open(stdout.name, stdout.mode + "b")
+        # Reopen stdout with specifying `newline` to avoid CRLF translation.
----------------
arichardson wrote:

```suggestion
        # Reopen stdout with `newline=""` to avoid CRLF translation.
```

https://github.com/llvm/llvm-project/pull/165950


More information about the libcxx-commits mailing list