forked from qt-creator/qt-creator
VCS[git]: Use QProcess::startDetached() if possible for gitk.
Task-number: QTCREATORBUG-1577
This commit is contained in:
@@ -1279,18 +1279,25 @@ void GitClient::launchGitK(const QString &workingDirectory)
|
|||||||
const QStringList arguments;
|
const QStringList arguments;
|
||||||
#endif
|
#endif
|
||||||
outwin->appendCommand(workingDirectory, binary, arguments);
|
outwin->appendCommand(workingDirectory, binary, arguments);
|
||||||
// This should use QProcess::startDetached ideally, but that does not have
|
// This should always use QProcess::startDetached (as not to kill
|
||||||
// an environment parameter.
|
// the child), but that does not have an environment parameter.
|
||||||
|
bool success = false;
|
||||||
|
if (m_settings.adoptPath) {
|
||||||
QProcess *process = new QProcess(this);
|
QProcess *process = new QProcess(this);
|
||||||
process->setWorkingDirectory(workingDirectory);
|
process->setWorkingDirectory(workingDirectory);
|
||||||
process->setProcessEnvironment(env);
|
process->setProcessEnvironment(env);
|
||||||
process->start(binary, arguments);
|
process->start(binary, arguments);
|
||||||
if (!process->waitForStarted()) {
|
success = process->waitForStarted();
|
||||||
outwin->appendError(tr("Unable to launch %1.").arg(binary));
|
if (success) {
|
||||||
delete process;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
connect(process, SIGNAL(finished(int)), process, SLOT(deleteLater()));
|
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,
|
bool GitClient::getCommitData(const QString &workingDirectory,
|
||||||
|
Reference in New Issue
Block a user