从缓冲 StdOut 程序中捕获输出 [英] Capturing output from buffered StdOut program

查看:48
本文介绍了从缓冲 StdOut 程序中捕获输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 Qt 和 Python 捕获 Windows 程序的输出.

I'm trying to capture the output of a windows program using Qt and Python.

我正在使用 QProcess 启动进程,但问题是输出正在被缓冲.不幸的是,我无权访问源代码,因此无法刷新输出.

I'm starting the process with QProcess, but the problem is the output is being buffered. Unfortunately I don't have access to the source, and therefore can't flush the output.

通过我的搜索,我找到了Expect"程序,但我不知道是否有免费的Windows版本.

From my searching around, I found the program "Expect", but I don't know if there is a free Windows version floating around.

不过,如果纯粹用 python 来做会很好.

It would be nice to do it purely in python though.

推荐答案

请看 QShared Memory http://doc.trolltech.com/main-snapshot/ipc-sharedmemory.html ... 你想要实现的是进程间通信,QShared 内存在 Linux 和 Windows 上都可以正常工作.

Please take a look at QShared Memory http://doc.trolltech.com/main-snapshot/ipc-sharedmemory.html ... What you want to achieve is inter process communication, QShared memory works fine on Linux and Windows alike.

这篇关于从缓冲 StdOut 程序中捕获输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆