Hacker News new | ask | show | jobs
by gourlaysama 2790 days ago
This is probably a stupid question, but doesn't the PTY itself already have that out-of-order problem? I mean that it reads both file descriptors and does interleave them in the end. If it didn't they could still colorize things after the PTY.

So I guess my question is, why can't whatever it does to handle the ordering and merge the two be replicated in a small program that reads two names pipes and does the same but with extra colorizing?

1 comments

Not normally, no. The file descriptors sort of act like pointers. During normal execution in a pty, stdrr and stdout both point to the same device with the same buffer. Nothing is handling the order because there is only one buffer being written to.
> Nothing is handling the order because there is only one buffer being written to.

Ah, that's what I was missing. Thank you, that makes sense.