PDA

View Full Version : QProcess state is running even when the program didnt start properly



dv_
7th August 2010, 14:16
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?

tbscope
7th August 2010, 14:45
Did the process actually crash?

dv_
7th August 2010, 14:51
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).

tbscope
7th August 2010, 15:12
Suggestion:
Use error() or readAllStandardError() or readyReadStandardError ()

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