aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/git/gitclient.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <[email protected]>2010-06-08 16:02:11 +0200
committerFriedemann Kleint <[email protected]>2010-06-08 16:02:11 +0200
commit33ec71adda4fc405d8e8bfea8d8d5aff1a33f2a6 (patch)
tree8982e8fe5418d71522ceef07abd0c21ec66c50b4 /src/plugins/git/gitclient.cpp
parent7dc2760f0e0b5b5b7587e0ee5826a75faddf8b7f (diff)
VCS[git]: Use QProcess::startDetached() if possible for gitk.
Task-number: QTCREATORBUG-1577
Diffstat (limited to 'src/plugins/git/gitclient.cpp')
-rw-r--r--src/plugins/git/gitclient.cpp29
1 files changed, 18 insertions, 11 deletions
diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp
index c9128ba4ac7..18e24bce510 100644
--- a/src/plugins/git/gitclient.cpp
+++ b/src/plugins/git/gitclient.cpp
@@ -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.
- 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;
+ // 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);
+ success = process->waitForStarted();
+ if (success) {
+ connect(process, SIGNAL(finished(int)), process, SLOT(deleteLater()));
+ } else {
+ delete process;
+ }
+ } else {
+ success = QProcess::startDetached(binary, arguments, workingDirectory);
}
- connect(process, SIGNAL(finished(int)), process, SLOT(deleteLater()));
+ if (!success)
+ outwin->appendError(tr("Unable to launch %1.").arg(binary));
}
bool GitClient::getCommitData(const QString &workingDirectory,