[llvm] [Lit] Open sub-processes with text=`False` (PR #194577)

Benjamin Stott via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 29 06:50:54 PDT 2026


BStott6 wrote:

@zeroomega Thanks for bringing this to my attention and making the fix-forward PR. I did not know that the `out` and `err` returned by Lit's `executeScriptInternal` were used for any purpose other than just displaying to the user, so I didn't consider checking that the newline encodings present here were the same as before - I was only concerned about the newlines from the perspective of the subprocesses and any files they read/write, not from the perspective of Lit reading the output at the end.

As the processes are no longer opened with `universal_newlines=True`, Python no longer performs the `\r\n -> \n` conversion when reading from their output, leading to the different newlines present in `out` and `err` returned from `executeScriptInternal`. I think we could achieve the old behaviour on the Lit side with a simple `replace(os.linesep, "\n")` when we decode the output. However, the advantage of the new behaviour is that the string returned by Lit is the exact output from the tool.

Do you think we should continue with your fix updating the libcxx format to work with the new behaviour, or instead apply the line ending normalisation in Lit to keep the behaviour the same as before?

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


More information about the llvm-commits mailing list