如何用python编写EOF到STDIN popen

2024-03-29 10:10:09 发布

您现在位置:Python中文网/ 问答频道 /正文

我在popen中运行以下命令:

p = subprocess.popen(["/usr/bin/whiptail", "--title", "\"Progress\"", "--gauge", "\"\"", "6", "50", "0"], stdout=subprocess.PIPE, stding=subprocess.PIPE)

要停止whiptail命令的运行,我需要将EOF发送到stdin。

如何用Python将EOF发送到stdin?

或者我打电话给p.terminate()


Tags: 命令bintitleusrstdinstdoutsubprocessprogress