messing with standard output streams

This recently came up at work: capture the STDERR/STDOUT from another process and ship it over a socket somewhere else for archiving and viewing purposes. It was trickier than I expected so I’m writing it down here for next time.