vpelletier / python-functionfs

Pythonic API for linux's functionfs
GNU General Public License v3.0
40 stars 13 forks source link

Flush stdout #30

Closed ransbachm closed 1 year ago

ransbachm commented 1 year ago

stdout is not flushed, hence there may not be output. I don't think this is the expected behavior for an example but correct me if the non-buffering is intentional. There may be more of these cases but I only used the "device.py" code.

image

vpelletier commented 1 year ago

Thanks you for this improvement, it is indeed better.

Some further background: While the buffering/lack of flushing was not intentional, I do not expect this code to work perfectly. Its main use is to illustrate how to develop for the functionfs module API, while on the one hand having little code on top of it, and on the other hand still doing something meaningful so the code can be understood. For example, all the transcoding happening is intended for keyboard input and terminal output, and is not something the traditional cat command does.