PDA

View Full Version : QProcess hangs



Skizmo
7th March 2007, 14:35
Hi,

specs : QT 4.1.3 on Windows 2000

I'm using QProcess to run a external program (gcc compiler). It looks like that as soon as the external program gives too much standard output (in this case compiler warnings from the gcc compiler) the external program hangs and QProcess doesn't return. Anybody here who knows something about this or how to fix it ??

wysota
7th March 2007, 20:45
You have to empty the pipe between QProcess and the application by reading the data. If you're not interested in the data, call QProcess::closeReadChannel() before starting the process.

Skizmo
8th March 2007, 09:57
Hi,

Thanx for the reply. I started to investigate way QT channels the output data, but I can't find enough backgrounddata on this topic. QT nicely describes the functions, but not the underlying idea of the functions. Do you have a link to more info on how the dataflow works ??

guilugi
8th March 2007, 10:01
You can directly check the Qt sources :)
For example, it helped me a lot to see the graphicsview framework sources to reimplement some methods.

wysota
8th March 2007, 10:27
The dataflow is like in any other simmilar case - when you run a process pipes are created and attached to stdin, stdout and stderr of the application under control and given to the controlling application to read/write data to it. When the "stdout" pipe fills, a subsequent call to write() blocks until there is some space in the pipe buffer. That's why you need to either read the data or discard the pipe.