I know this post is kinda old now but I know what's wrong with Ilya's answer (to my understanding). Since the QProcess
is created within a local scope, whenever you call a process outside of the scope the destructor will be automatically called, and kill the process along the way, as the debug message implies:
Destroyed while process ("git") is still running.
One way to fix this is by actually dynamically allocate an instance of QProcess
on the heap. Make sure to free the memory after the process is finished.
QProcess* process = new QProcess;
process->setWorkingDirectory("D:\\MyWork\\Temp\\source");
process->start("git", QStringList() << "gui");
Or to wait until the process is finished, using
process.waitForFinished (-1);
I hope this will help for anyone looking for the right answer in this post.