# HG changeset patch
# User Chris Cannam
# Date 1292863620 0
# Node ID 6bb510abe4f195313bac74ff55de402eba4ee372
# Parent 07b908b4fa5f91904c1af36d546a639fa039010e
* Handle failure to start processes at all (e.g. because executable path is wrong)
diff -r 07b908b4fa5f -r 6bb510abe4f1 hgrunner.cpp
--- a/hgrunner.cpp Mon Dec 20 16:15:43 2010 +0000
+++ b/hgrunner.cpp Mon Dec 20 16:47:00 2010 +0000
@@ -68,8 +68,9 @@
// If we haven't unbundled an extension, always do that (so that
// it's available in case someone wants to use it later, e.g. to
// fix a malfunctioning setup). But the path we actually prefer
- // is the one in the settings first; then the unbundled one; then
- // anything in the path if for some reason unbundling failed
+ // is the one in the settings first, if it exists; then the
+ // unbundled one; then anything in the path if for some reason
+ // unbundling failed
QSettings settings;
settings.beginGroup("Locations");
@@ -80,7 +81,7 @@
}
QString extpath = settings.value("extensionpath", "").toString();
- if (extpath != "") return extpath;
+ if (extpath != "" && QFile(extpath).exists()) return extpath;
extpath = unbundled;
if (extpath == "") {
@@ -330,6 +331,11 @@
}
}
+void HgRunner::error(QProcess::ProcessError)
+{
+ finished(-1, QProcess::CrashExit);
+}
+
void HgRunner::finished(int procExitCode, QProcess::ExitStatus procExitStatus)
{
// Save the current action and reset m_currentAction before we
@@ -343,7 +349,7 @@
m_currentAction = HgAction();
closeProcInput();
- delete m_proc;
+ m_proc->deleteLater();
m_proc = 0;
if (completedAction.action == ACT_NONE) {
@@ -446,6 +452,8 @@
m_proc->setProcessEnvironment(env);
connect(m_proc, SIGNAL(started()), this, SLOT(started()));
+ connect(m_proc, SIGNAL(error(QProcess::ProcessError)),
+ this, SLOT(error(QProcess::ProcessError)));
connect(m_proc, SIGNAL(finished(int, QProcess::ExitStatus)),
this, SLOT(finished(int, QProcess::ExitStatus)));
connect(m_proc, SIGNAL(readyReadStandardOutput()),
diff -r 07b908b4fa5f -r 6bb510abe4f1 hgrunner.h
--- a/hgrunner.h Mon Dec 20 16:15:43 2010 +0000
+++ b/hgrunner.h Mon Dec 20 16:47:00 2010 +0000
@@ -45,6 +45,7 @@
private slots:
void started();
+ void error(QProcess::ProcessError);
void finished(int procExitCode, QProcess::ExitStatus procExitStatus);
void dataReadyStdout();
void dataReadyStderr();
diff -r 07b908b4fa5f -r 6bb510abe4f1 mainwindow.cpp
--- a/mainwindow.cpp Mon Dec 20 16:15:43 2010 +0000
+++ b/mainwindow.cpp Mon Dec 20 16:47:00 2010 +0000
@@ -1398,7 +1398,7 @@
QMessageBox::warning
(this, tr("Failed to run Mercurial"),
format3(tr("Failed to run Mercurial"),
- tr("The Mercurial program either could not be found or failed to run.
This may indicate a problem with the Mercurial installation, or with the EasyHg interaction extension.
The test command said:"),
+ tr("The Mercurial program either could not be found or failed to run.
This may indicate a problem with the Mercurial installation, or with the EasyHg interaction extension.
%1").arg(output == "" ? QString("") : tr("The test command said:")),
output));
settings();
return;