Piping output of subprocess.Popen to files
问题 I need to launch a number of long-running processes with subprocess.Popen , and would like to have the stdout and stderr from each automatically piped to separate log files. Each process will run simultaneously for several minutes, and I want two log files ( stdout and stderr ) per process to be written to as the processes run. Do I need to continually call p.communicate() on each process in a loop in order to update each log file, or is there some way to invoke the original Popen command so