Force another program’s standard output to be unbuffered using Python

You can use PTYs to solve this by:

  • Creating a pty master/slave pair;
  • Connecting the child process’s stdin, stdout and stderr to the pty slave device;
  • Reading from and writing to the pty master in the parent.

Leave a Comment