由网友(骑猪闯天下)分享简介:注意:我看过有关此问题的其他帖子,但没有一个帖子可以解释答案,也没有一个帖子起作用。有没有办法实时获取exec_command,特别是Paramiko包的exec_command('docker run ')的输出?推荐答案您可以阅读ChannelFile(http://docs.para...![win10系统excel怎么才能创建多个独立窗口](https://p.xsw88.cn/allimgs/daicuo/20230903/4615.png)
注意:我看过有关此问题的其他帖子,但没有一个帖子可以解释答案,也没有一个帖子起作用。
有没有办法实时获取exec_command
,特别是Paramiko包的exec_command('docker run <CONTAINER_ID>')
的输出?
推荐答案
![win10系统excel怎么才能创建多个独立窗口](https://p.xsw88.cn/allimgs/daicuo/20230903/4615.png)
您可以阅读ChannelFile
(http://docs.paramiko.org/en/2.4/api/channel.html?highlight=stdout#paramiko.channel.ChannelFile)中的行。
示例:
stdin, stdout, stderr = client.exec_command('docker run <CONTAINER_ID>')
while True:
line = stdout.readline()
if not line:
break
print(line, end="")
相关推荐
最新文章