0

I am using Tokio in Rust to pipe the outputs of different commands to the screen, and one problem I encountered is that Python didn't seem to work. In looking into it further, it seems that running the python command with the -u flag fixes this by forcing there to be no stdout buffer, but it seems like there is a potential performance tax, and there are other programs with buffered output which I want to be able to catch. This isn't a problem when running in a console window or SSH directly, just with the Rust wrapping. I am wary of just using the flags as my Rust program is supposed to be able to work with any console program, not just Python. Going off of the assumption that most programs would use similar logic to Python, is there any way I can trigger a flush from the outside, without using flags? Alternatively, is there any way I can convince Python that it is running in a console window instead of a Rust wrapper?

Sith Siri
  • 61
  • 6

0 Answers0