Solved Sometimes qprocess does not work (about children?)
-
QProcess p;
p.start("one.exe", arguments);
p.waitForFinished(-1);Sometimes this process works (3 children), sometimes does not (2 children). Any help?
-
@Konstantinos
What do you mean with 3 children?You start three applications in a row and the last is not started?
In that case you may face an endless loop in the last application started. It is not ended or may wait for input from somewhere. With p.waitForFinished(-1) you wait inifinitely until the application you have started finishes.
-
Sometimes when I call this process, it works and it has three children, two of type QWindowsPipeReader and one of type QWinEventNotifier:
But some other times, when I call this process, it does not work and it just has two children of type QWindowsPipeReader:
Why may it happen?
Process finishes (if it starts) after a few seconds. I am tracking it using task manager.
-
One still needs a crystal ball to give you an answer.
As far as I see your process runs into some kind of exception and dies. You need to monitor the output channels of your process and see if there is some output you can interpret. Check out readAllStandardError and readAllStandardOutput
-
In both cases(does - does not work), they (both readAllStandardError and readAllStandardOutput) give me nothing. Just a blank - vacuum:""
To help you a little to help me, the process does not work, when I call another class before calling this process. If I don't call this class, the process works well, but if I call this class, then the problems appear.
So, the question is, what this class may do, to influence another process in a completely different location?
-
No clue what that could be. My crystal ball is broken ;)
You would be required to ask the oracle of delphi for that one.
Nobody can give you advice without knowing all the details.It could be anything from exhausted memory by this additional to eating away the complete throughput of CPU or comm channels.
You need to check what you are doing in that class and how it might interfere with your other process you start. Some issues are listed above. There might be dozens of more possible issues.
-
Ok I found the problem.
As I said this is the process:
QProcess p;
p.start("one.exe", arguments);
p.waitForFinished(-1);It looks for one.exe in its default directory, but in the other class, I changed the directory of the app.
-
Glad you found your problem. Thanks for feedback.