QProcess::startDetached(exe) vs OS system( start exe)
-
I am implementing a way to install update after download and and I am having some problems with
QProcess::startDetached()
.
I quit application right after theQProcess::startDetached()
is called and that makes my app crash, I used a timer that would quit the app after 2secs but it leaves the app hanging and then it quits but I am not vey ok with that hanging time.Edit: OS start alsos crashes my app.
So I decided to use to the OS system() instead which sometimes it works as I want it to but sometimes it does not and it crashes my app. I don't know what it is causing my app to crash.void FileDownloader::install() { // QProcess::startDetached(exe); exe.insert(0, "start "); system(exe.toStdString().c_str()); this->close(); qApp->quit(); }
-
@hbatalha said in QProcess::startDetached(exe) vs OS system( start exe):
and that makes my app crash
What crash is it exactly? Do you have more information?
I guess you want to update the executable which starts the other process, right? In this case that other process should wait, so it does not try to update the executable which is still running (on Windows this will not work). -
@jsulm said in QProcess::startDetached(exe) vs OS system( start exe):
What crash is it exactly? Do you have more information?
It freezes my app
I guess you want to update the executable which starts the other process, right?
Yeah, the installer will start, by the way I am on Windows right now, and then I will probably want the same behaviour on Linux
-
@hbatalha said in QProcess::startDetached(exe) vs OS system( start exe):
It freezes my app
Well, this is not the same as a crash.
Can you show how you used QProcess::startDetached()? -
@hbatalha said in QProcess::startDetached(exe) vs OS system( start exe):
Edit: OS start alsos crashes my app.
So I decided to use to the OS system() instead which sometimes it works as I want it to but sometimes it does not and it crashes my app. I don't know what it is causing my app to crash.So you have no evidence
QProcess::startDetached()
is the cause of your problem. We don't know why your app might crash. If it does so totally outside of a Qt program it may have nothing to do with Qt, and we can't help you on that. -