Pedro Tammela ca17571051 [LLDB-lua] modify Lua's 'print' to respect 'io.stdout'
This patch changes the implementation of Lua's `print()` function to
respect `io.stdout`.

The original implementation uses `lua_writestring()` internally, which is
hardcoded to `stdout`.

Reviewed By: JDevlieghere

Differential Revision: https://reviews.llvm.org/D90787
2020-11-05 21:23:20 +00:00

24 lines
689 B
Plaintext

# REQUIRES: lua
# UNSUPPORTED: lldb-repro
#
# RUN: rm -rf %t.stderr %t.stdout
# RUN: cat %s | %lldb --script-language lua 2> %t.stderr > %t.stdout
# RUN: cat %t.stdout | FileCheck %s --check-prefix STDOUT
# RUN: cat %t.stderr | FileCheck %s --check-prefix STDERR
script
file = lldb.SBFile(2, "w", false)
lldb.debugger:SetOutputFile(file)
print(95000 + 126, nil, 'a')
quit
script
print({})
quit
# STDOUT: 95126 nil a
# STDOUT-NOT: table: {{0x[[:xdigit:]]+}}
# STDERR: table: {{0x[[:xdigit:]]+}}
# RUN: rm -rf %t.stderr %t.stdout
# RUN: %lldb --script-language lua -o 'script print(95000 + 126, nil, "a")' 2> %t.stderr > %t.stdout
# RUN: cat %t.stdout | FileCheck %s --check-prefix STDOUT