如何在 python 中将 EOF 写入 STDIN popen
How to write EOF to STDIN popen in python
我有以下命令 运行 通过 popen:
p = subprocess.popen(["/usr/bin/whiptail", "--title", "\"Progress\"", "--gauge", "\"\"", "6", "50", "0"], stdout=subprocess.PIPE, stding=subprocess.PIPE)
要停止来自 运行ning 的 whiptail 命令,我需要将 EOF 发送到标准输入。
如何在 Python 中将 EOF 发送到标准输入?
或者我直接调用 p.terminate()
您需要关闭用作脚本标准输入的文件。
所以你的情况是 p.stdin.close()
。
我有以下命令 运行 通过 popen:
p = subprocess.popen(["/usr/bin/whiptail", "--title", "\"Progress\"", "--gauge", "\"\"", "6", "50", "0"], stdout=subprocess.PIPE, stding=subprocess.PIPE)
要停止来自 运行ning 的 whiptail 命令,我需要将 EOF 发送到标准输入。
如何在 Python 中将 EOF 发送到标准输入?
或者我直接调用 p.terminate()
您需要关闭用作脚本标准输入的文件。
所以你的情况是 p.stdin.close()
。