If I generate multiple subprocess.Popen(['commands', 'that', 'I', 'called']) and for each I do stdin.write(..) or p.communicate(...)to interact with the commands, is it guarantee to be independent and will come back to the each process (stdout from the called command)?
If I generate multiple subprocess.Popen([‘commands’, ‘that’, ‘I’, ‘called’]) and for each I do stdin.write(..)
Share
If you do this:
You will get a separate set of pipes for each process. The value
subprocess.PIPEis just a special flag to tellsubprocess.Popen()to create a new pipe — so the above command creates two new pipes: one pipe forstdinand a separate pipe forstdout.If you do this:
The new process will share
stdin,stdout, andstderrwith your process (well, basically — the kernel side will be shared).