Hi folks, I'm currently wondering how to take a StreamReader as found on https://docs.python.org/3/library/asyncio-subprocess.html#asyncio.subprocess.Process and to consume the data while optionally re-streaming it to a secondary consumer.
What I'd like to do is create a StreamWatcher class that consumes console data while optionally logging to python logging and/or a file; but re-buffers the data into an async stream where an additional consumer is free to use the "standard asyncio API" to consume console data at their leisure in a way that's unsurprising. What I'd like this *for* is to be able to do aggressive logging of stdout/stderr and console data without denying tests the ability to consume the data as they see fit for their testing purposes. I want to have my cake and eat it too, and we don't do a good job of managing this consistently across the board. I am wondering if there's any way around creating a literal socketpair and suffering the creation of a full four StreamReader/StreamWriter instances (one pair per socket...) and then just hanging on to the "unused" reader/writer per each. It seems kind of foolishly excessive. It also seems like it might be a pain in the butt if I want cross-platform compatibility with windows for the machine appliance. Anyone got any bright ideas? --js