r-wasm / webr

The statistical language R compiled to WebAssembly via Emscripten, for use in web browsers and Node.
https://docs.r-wasm.org/webr/latest/
Other
804 stars 54 forks source link

Flush incomplete lines when capturing streams with `Shelter.captureR()` #419

Closed georgestagg closed 2 months ago

georgestagg commented 2 months ago

Closes #412.

Before:

> (await webR.globalShelter.captureR('cat("foo\nbar")')).output
< [
    {type: 'stdout', data: 'foo'},
  ]

After:

> (await webR.globalShelter.captureR('cat("foo\nbar")')).output
< [
    {type: 'stdout', data: 'foo'},
    {type: 'stdout', data: 'bar'},
  ]