[Interest] QProcess vs popen: bug?
Thiago Macieira
thiago.macieira at intel.com
Thu Nov 12 22:54:20 CET 2015
On Thursday 12 November 2015 14:33:00 Bob Hood wrote:
> I had a look at the code for QProcess, which seems to be doing standard
> fork/exec launching of the process, whereas, if I'm not mistaken, popen()
> uses the shell to run it. Is that the only difference here? Should I be
> running the QProcess version through the shell explicitly then to make it
> function?
No, it's not the only difference, but you can try to go through the shell to
see if it solves your problem.
The first thing you have to isolate when there's an I/O problem between
multiple processes (pipes, sockets, etc.) is to isolate which side is at
fault. Your symptom is that QProcess does not report anything ready to read.
Why is that?
Which side is at fault here? Did the child process even write anything to its
pipes? If not, then QProcess is blameless.
One more thing: the two snippets you pasted are not equivalent. For the
QProcess case, you stopped at waitForStarted(), which only reports that the
execve(2) call succeeded. It does not mean the main() function in the child
process has been reached. On the popen case, you pasted code that does the
I/O.
So it's entirely possible there's a bug in your code but it's not in the parts
you pasted.
--
Thiago Macieira - thiago.macieira (AT) intel.com
Software Architect - Intel Open Source Technology Center
More information about the Interest
mailing list