Output buffer difference between `Shelter.captureR()` and `Console()`
coatless opened this issue · comments
Relevant ticket: coatless/quarto-webr#208
The main issue is the lines from writing a data.frame
with gt()
to STDOUT are exceeding the buffer associated with Shelter.captureR()
but not Console()
.
So, the webR REPL is able to correctly output the results; but, the Shelter.captureR()
is not able to.
webr::install("gt")
gt::gt(mtcars) |> print(view = FALSE)
Under REPL:
Under Shelter.captureR()
:
This is a consequence of how R output is captured when running in the non-console context.
See:
webr/packages/webr/src/outputconnection.c
Lines 46 to 51 in c07d899
and:
webr/packages/webr/src/outputconnection.c
Lines 98 to 105 in c07d899
We should consider:
- Increasing
BUFSIZE
in the short term. - Adding a mechanism to dynamically grow
output_con_data
in the longer term.
The OP issue would also be solved by handling htmlwidget output correctly, avoiding need to capture raw HTML and output: asis
. I'm working on this separately as part of our previously discussed Quarto/webR integration project.