Program A, is a c program that endlessly, receives input in stdin, process it and output it to stdout.
I want to write program B (in python) so it will reads A's output, and feed it back with whatever is needed. Note there must be only one instance of each of those programs, so given b1 and b2 which are instances of b instead of:
$ b1 | a | b2
I need to have
$ b1 | a | b1
The following is the diagram of the final desired result: