没有控制TTY时无法运行交互式控制台

时间:2014-11-23 06:24:09

标签: python popen

我正在尝试使用POPEN命令读取和写入guest-vm控制台。阅读(stdout)工作正常,但是当我将stdin添加到POPEN时,我得到了#34;没有控制TTY"就无法运行交互式控制台。感谢有关如何克服此错误的任何建议。

p = Popen(["virsh", "console", "guest-vm"],
          shell=False, stdin=PIPE, stdout=PIPE, close_fds=True)

for line in iter(p.stdout.readline, b''):
    if line == "SUCCESS":
        p.stdin.write('\n')

错误: 错误:无法在没有控制TTY的情况下运行交互式控制台

1 个答案:

答案 0 :(得分:2)

你有没有尝试过:

ssh -t <user>@<libvirthost> virsh console <vm_name>

其中:  user - libvirthost上存在的用户  libvirthost - 运行libvirt VM的地方

More here

相关问题