What tricks do you suggest to prevent interleaving? It's not clear it's possible at all.
What tricks do you suggest to prevent interleaving? It's not clear it's possible at all.
Python by default starts buffering output when it's not connected to a PTY, which causes a lot of issues with interactive output.
There's no guarantee of ordering between stdout/stderr, so line buffering them, or displaying them in separate UI sections, or even doing some non-blocking reading to flush one fully before flushing the other, should be sufficient.
That's a non-starter. We think barring a great UX improvement, the environment should look as predictable and as close to a local setup as possible.
If line buffering isn't enough, you can use heuristics around read sizes and non-blocking reading to guess whether a given write to the pipe was intended to be done as a block.
There absolutely is. If the two file descriptors refer to the same open file description or the same pipe/socket/character device, then the ordering of write syscalls is preserved--and that is the default for terminals.