Launching of process on mac using Qt
i am working on sample applications using QT on Mac and i found out problem with one of its API. I want to run process so i am using following function
And i am passing program(location of exe )and argument list as parameter now problem is that if the application is allready running then the this will create another process and runs it where as when i cross cheked with Windows its behavior is different in the sense that it does not start application which is allready running. can anyone help me how to fix the issue??
When you call the QProcess::startDetached() you will not have a QProcess identifier (member variable) so your program is unaware of any already running programs. That shouldn't be any different between Mac and Win.
What the difference might be is the startup sequence of the process started. Maybe it checks if it is already running and doesn't start again. If the programmer made an error there the difference between Mac and Win is explainable.
A solution otherwise is to keep a member variable of QProcess and when the program needs to be started again check if the program is still running. You get a signal if anything happens with the QProgress that you already started. If you want to close your application, but keep the other program active, just exit the program and the program should keep on going. If you want to close it, you simple call qproc.close();
Hope this helps!