0

I'd like to run a (bunch of) process(es) using subprocess.run() (or similar) and process each line of its stdout and stderr distinguishable from each other and simultaneously (i.e. not waiting for the process to terminate), e.g. to (in real-time) prefix something and/or add color, match against regexes etc.

Someone asked a similar question and there is also an answer that would satisfy my requirements but it works with threads and looks complicated.

Is there a recommendable way to do this without threads, eg. using async processing of stdio and stderr at the same time?

frans
  • 7,810
  • 11
  • 47
  • 115

0 Answers0