标签: python
关闭已传递给Popen的文件对象是否安全?例如:
import subprocess fp = open('log.txt', 'w') args = ... popen = subprocess.Popen(args, stdout=fp) fp.close() # <--- Is this OK? popen.wait()