这个问题的子进程通信的多个时间不是可以用Python
Communicate multiple times with a process without breaking the pipe?
重复这个问题就解决了,因为它的使用情况下输入可以一起发送,但如果你的程序,这是不正确的是交互式的(如这里的用例所示)。
文件subprocess.Popen
说:
communicate(input=None)
Interact with process: Send data to stdin. Read data from stdout
and stderr, until end-of-file is reached. Wait for process to
terminate. ...
是否有可能终止其与前一个终端或网络套接字与子多次沟通,怎么样?
例如,如果子进程为bc
,则父进程可能希望根据需要发送不同的输入进行计算。由于输入发送到bc
可能取决于用户输入,所以不可能一次发送所有输入。