Results 1 to 4 of 4

Thread: QProcess state is running even when the program didnt start properly

  1. #1
    Join Date
    Feb 2008
    Posts
    12

    Default QProcess state is running even when the program didnt start properly

    I am using QProcess for controlling a background worker process. Recently I noticed that the state() return value is set to Running even when the worker didn't start properly. It is correctly set to NotRunning when the executable cannot be found or cannot be started due to permission problems. However, the executable is linked to some shared libraries, and when they were missing, the executable didn't start properly, but QProcess::state() still returned Running, pid() still returns a nonzero PID and so on.

    Now I wonder, how can I catch cases like the aforementioned one to avoid false positives?

  2. #2
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: QProcess state is running even when the program didnt start properly

    Did the process actually crash?

  3. #3
    Join Date
    Feb 2008
    Posts
    12

    Default Re: QProcess state is running even when the program didnt start properly

    No, it is not a crash. It just exits with a "cannot open shared object file: No such file or directory" error. As said, it requires some shared libraries. I want to be able to inform the user that the executable didn't start properly, and give hints what could be wrong (for example, shared libraries may be missing).

  4. #4
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: QProcess state is running even when the program didnt start properly

    Suggestion:
    Use error() or readAllStandardError() or readyReadStandardError ()

    See what it says after you tried to run the process.

Similar Threads

  1. QProcess Problem: Program doesnt start
    By musaulker in forum Newbie
    Replies: 5
    Last Post: 1st May 2020, 00:07
  2. Http example of Qt not running properly
    By thanisha in forum Newbie
    Replies: 2
    Last Post: 24th June 2010, 13:06
  3. Replies: 5
    Last Post: 17th March 2010, 19:30
  4. QProcess start a console program
    By Shawn in forum Qt Programming
    Replies: 2
    Last Post: 9th November 2007, 13:38
  5. Replies: 1
    Last Post: 17th May 2006, 01:23

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.