[Qt-interest] QProcess not emitting readyRead for blocking processes

Rohan Prabhu rohan at rohanprabhu.com
Wed Sep 8 11:48:59 CEST 2010


> You have three options:
>
> 1) just wait, because the data is being written and will eventually arrive
>

That is taking infinitely long. I tried waiting for around 150-200
seconds. If it doesn't come by then, it mostly isn't ever going to
come.



> 2) modify the target application to force it to use line-buffering. Some tools
> have that option, others you may have to modify the source code. Add this to
> some place:
>
>        setlinebuf(stdio);              // BSD extension
> or
>        setvbuf(stdio, (char *) NULL, _IOLBF, 0); /* ISO C */
>

The USP of the application I'm writing is that it works with whatever
is installed, be it on the server or the client [where it is run from]
and does not require any additional installations. In which case, the
modification as you put it, would quite defeat the purpose.

> 3) use a terminal instead of a pipe. This requires that you know how to open a
> terminal master on your system. You can do it with QProcess but you need to
> write some code for it. The upside is that no tools need to be modified.
>

This seems like a good option to me, however I have no clue what one
means by "terminal master". I looked it up a little, and I'm currently
reading the man page for openpty. Am I going in the right direction?

>Note that ssh has that option:
>
>ssh -t
>

I tried that, but even this ain't working :(. QProcess still ain't
emitting any readyRead signal indefinitely.

And thanks a lot for your help :). I think i'll keep looking on the
"terminal master" thing you said, sounds like it might lead me to a
solution.

Thanks again,
rohan




More information about the Qt-interest-old mailing list