Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/silverlight/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何用python将EOF写入STDIN popen_Python_Subprocess_Popen_Whiptail - Fatal编程技术网

如何用python将EOF写入STDIN popen

如何用python将EOF写入STDIN popen,python,subprocess,popen,whiptail,Python,Subprocess,Popen,Whiptail,我通过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()您需要的

我通过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()

您需要的是关闭用作脚本标准输入的文件


所以在你的例子中,它是
p.stdin.close()

切向的,你真的想要
Progress
用引号括起来——好像它不是真正的进步?