Reputation: 329
So I am using the following in my script to capture the stdout and stderr output from my subprocess:
output = subprocess.check_output(
cmd,
stderr=subprocess.STDOUT
)
This is working swimmingly, however, my subprocess has a subprocess it itself calls. The subprocess it itself calls has output I would like to capture. However, with my current set up, I only capture the output of the subprocess I create, and do not receive any of the output of it's child process.
Is there any way I can capture the output of any child subprocess spawned by a subprocess that my code is starting?
Upvotes: 2
Views: 268
Reputation: 196
The process cannot access to the output of the sub-subprocess so the intermediate subprocess has to behave as a proxy (it writes in its output the output of the sub-subprocess) or the sub-subprocess has to send its output somewhere (a temporary file for example) which will be read by the process
Upvotes: 1