I am writing a test for a toy distributed system. In the test, I spin two components locally and make them talk to each other. I use printf for debugging, so I want a simple and unambiguous way to get the node’s stderr.
The problem is that there are two stderr streams, but my driver program only have one. I need to come of with some way to multiplex several streams into one, and so I am wondering what’s the prior art here. I am looking for simplicity and convenience, rather than robustness and production readiness. The options I can think about, none of which are particularly appealing:
tail -f– probably what I want in terms of final result, but requires a lot of manual steps after I run the binary. Also makes it annoying to
^Cthe whole thing.
Is there perhaps some secret ANSI
cheat escape code to unlock bonus file descriptors for stderr2 and such? Or perhaps there’s some existing library which implements something like mini-tmux? Really, interested in any prior art here, as I feel like I’ve seen this problem several times, but I can’t recall any nifty real-world solutions.