Almenon / AREPL-backend

TS interface to python evaluator for AREPL
MIT License
12 stars 8 forks source link

Incorrect stdout buffering mode #118

Closed Almenon closed 4 years ago

Almenon commented 4 years ago

According to https://eklitzke.org/stdout-buffering programs should line-buffer stdout when printing to terminal. I want to replicate the terminal experience so I should line-buffer the output instead of having it unbuffered.

Note that stderr should remain unbuffered.

I didn't see a way to specify buffering mode on node side so I guess I should do it python side.

I can use the argument buffering=1 to specify line buffered.

https://stackoverflow.com/questions/107705/disable-output-buffering https://medium.com/@bramblexu/three-ways-to-close-buffer-for-stdout-stdin-stderr-in-python-8be694bd2737

Almenon commented 4 years ago

Another way of doing this might be to create a tty device in node and use that as stdout so python thinks it is printing to the terminal. I'm not sure what the full ramifications of that would be though. Also I think configuring stdout to be line buffered in python would be easier.

Almenon commented 4 years ago

https://github.com/chjj/pty.js

Almenon commented 4 years ago

:tada: This issue has been resolved in version 1.3.9 :tada:

The release is available on:

Your semantic-release bot :package::rocket: