VCS[git]: Use QProcess::startDetached() if possible for gitk.

Task-number: QTCREATORBUG-1577
This commit is contained in:
Friedemann Kleint
2010-06-08 16:02:11 +02:00
parent 7dc2760f0e
commit 33ec71adda

View File

@@ -1279,18 +1279,25 @@ void GitClient::launchGitK(const QString &workingDirectory)
const QStringList arguments;
#endif
outwin->appendCommand(workingDirectory, binary, arguments);
// This should use QProcess::startDetached ideally, but that does not have
// an environment parameter.
// This should always use QProcess::startDetached (as not to kill
// the child), but that does not have an environment parameter.
bool success = false;
if (m_settings.adoptPath) {
QProcess *process = new QProcess(this);
process->setWorkingDirectory(workingDirectory);
process->setProcessEnvironment(env);
process->start(binary, arguments);
if (!process->waitForStarted()) {
outwin->appendError(tr("Unable to launch %1.").arg(binary));
delete process;
return;
}
success = process->waitForStarted();
if (success) {
connect(process, SIGNAL(finished(int)), process, SLOT(deleteLater()));
} else {
delete process;
}
} else {
success = QProcess::startDetached(binary, arguments, workingDirectory);
}
if (!success)
outwin->appendError(tr("Unable to launch %1.").arg(binary));
}
bool GitClient::getCommitData(const QString &workingDirectory,