Results 1 to 5 of 5

Thread: QProcess hangs

  1. #1
    Join Date
    Jun 2006
    Posts
    13
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question QProcess hangs

    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 ??

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QProcess hangs

    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.

  3. #3
    Join Date
    Jun 2006
    Posts
    13
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QProcess hangs

    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 ??

  4. #4
    Join Date
    Jan 2006
    Location
    Paris, France
    Posts
    227
    Thanks
    3
    Thanked 21 Times in 21 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QProcess hangs

    You can directly check the Qt sources
    For example, it helped me a lot to see the graphicsview framework sources to reimplement some methods.

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QProcess hangs

    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.

  6. The following user says thank you to wysota for this useful post:

    Skizmo (13th March 2007)

Similar Threads

  1. Replies: 1
    Last Post: 6th March 2007, 15:27
  2. Quoting problem with QProcess
    By the_bis in forum Qt Programming
    Replies: 1
    Last Post: 15th December 2006, 11:24
  3. QProcess' writeToStdin
    By Shlainn in forum Qt Programming
    Replies: 2
    Last Post: 19th September 2006, 13:08
  4. problem with qprocess
    By deekayt in forum Qt Programming
    Replies: 2
    Last Post: 13th June 2006, 13:30
  5. QProcess in a QThread
    By chombium in forum Qt Programming
    Replies: 2
    Last Post: 11th January 2006, 15:52

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.