QProcess state NotRunning but it is...
-
I use QProcess to start an two instances of gedit, the instances are running and when I try to launch a third I test the processes already running using the state function, however the state returns NotRunning.
When I launch the process I keep the instances of QProcess that were used to create the instances, are these not live?
Is it because I'm starting the processes with startDetached ?
-
startDetached() does what it means - it starts the process and has no control or information of it afterwards.
-
startDetached() does what it means - it starts the process and has no control or information of it afterwards.
@Christian-Ehrlicher , having now replaced startDetached with start the behaviour is the same it still returns the state NotRunning when it is.
-
@Christian-Ehrlicher , having now replaced startDetached with start the behaviour is the same it still returns the state NotRunning when it is.
@SPlatten said in QProcess state NotRunning but it is...:
having now replaced startDetached with start the behaviour is the same it still returns the state NotRunning when it is.
Just to be sure, how do you check process state?
As Qt is an asynchronous framework, you have giveQProcessthe ability to update his states, means the thread event loop must not be locked. -
@SPlatten said in QProcess state NotRunning but it is...:
having now replaced startDetached with start the behaviour is the same it still returns the state NotRunning when it is.
Just to be sure, how do you check process state?
As Qt is an asynchronous framework, you have giveQProcessthe ability to update his states, means the thread event loop must not be locked.@KroMignon , I call state on the process when a new process is added by the application. The application keeps track of the number of instances launched and check that the launched processes are still running.
Before launching a process I check a list of existing processes, calling the state of each process.
-
@SPlatten said in QProcess state NotRunning but it is...:
having now replaced startDetached with start the behaviour is the same it still returns the state NotRunning when it is.
Just to be sure, how do you check process state?
As Qt is an asynchronous framework, you have giveQProcessthe ability to update his states, means the thread event loop must not be locked.@KroMignon , i've just implemented a connection to the stateChanged signal and what I'm seeing is that the state is intially 2 QProcess::Running on first signal then changes almost instantly to 0 QProcess::NotRunning, yet the process is still running.
Interestingly, I have added another process to test, which is gcalctool a calculator and this doesn't exhibit the same problem the state is 2 and remains 2, its only gedit that shows up this issue.
-
@KroMignon , i've just implemented a connection to the stateChanged signal and what I'm seeing is that the state is intially 2 QProcess::Running on first signal then changes almost instantly to 0 QProcess::NotRunning, yet the process is still running.
Interestingly, I have added another process to test, which is gcalctool a calculator and this doesn't exhibit the same problem the state is 2 and remains 2, its only gedit that shows up this issue.
@SPlatten said in QProcess state NotRunning but it is...:
Interestingly, I have added another process to test, which is gcalctool a calculator and this doesn't exhibit the same problem the state is 2 and remains 2, its only gedit that shows up this issue.
Okay, now I understand your problem.
If you want to have multiplegeditrunning instances, you have to startgeditwith-sor--standalone, or you will just open a new tab in currentgeditinstance.
Has nothing to do withQProcess;) -
@SPlatten said in QProcess state NotRunning but it is...:
Interestingly, I have added another process to test, which is gcalctool a calculator and this doesn't exhibit the same problem the state is 2 and remains 2, its only gedit that shows up this issue.
Okay, now I understand your problem.
If you want to have multiplegeditrunning instances, you have to startgeditwith-sor--standalone, or you will just open a new tab in currentgeditinstance.
Has nothing to do withQProcess;)@KroMignon , thank you, that makes sense, again, typical that I choose and application to test that exhibits this behavour.
[edit] just checked the version of gedit I'm using doesn't have that switch, its version 2.30.4 running on:
Linux 3.10.37-finx-rt12-generic