Files
llvm-project/lldb/test/Shell/ScriptInterpreter/Python/io.test
Ebuka Ezike 78f9d78b13 [lldb] Fix Python stderr redirection in test (#177970)
Python's internal stderr may differ from sys.stderr. 
When Python writes errors, it uses its internal stderr rather than the
overwritten sys.stderr.
This may not be the same file/handle

Fix the test to explicitly write to the specified stderr.
2026-01-26 22:20:55 +00:00

16 lines
397 B
Plaintext

# UNSUPPORTED: system-windows
# RUN: rm -rf %t.stdout %t.stderr
# RUN: cat %s | %lldb --script-language python > %t.stdout 2> %t.stderr
# RUN: cat %t.stdout | FileCheck %s --check-prefix STDOUT
# RUN: cat %t.stderr | FileCheck %s --check-prefix STDERR
script
import sys
variable = 250 + 5
print(variable)
print("wrote to", "stderr", file=sys.stderr)
quit
# STDOUT: 255
# STDERR: wrote to stderr