We have:
- A Python based server (A)
- A running command-line application (on the same Linux machine) which is able to read
stdin, computes something and provides the output intostdout(B)
What is the best (most elegant) way how to send an input from (A) to stdin of (B), and wait for an answer from (B), i.e read its stdout?
As @Deestan pointed subprocess,module, is an elegant and proven one. We use subprocess a lot when we have to run commands from python.
Ours mostly involves running a command, mostly in-house built, and capturing its output. Our wrapper to run such commands looks thus.
If your input to B is minimal then subprocess is a yes.