Commit 5fb7f6a2 authored by Andreas Pakulat's avatar Andreas Pakulat
Browse files

QProcess naturally doesn't emit "finished" when it couldn't even start the

process (like the executable to start not being in the path). Instead it emits
error() in that case. So also connect to the error signal.

The other option would be to use QProces::waitForStarted(), to make sure the
git-execution actually starts, in GitJob::start().
parent 46c051be
......@@ -135,6 +135,8 @@ void GitJob::start()
connect(d->childproc, SIGNAL(finished(int, QProcess::ExitStatus)),
SLOT(slotProcessExited(int, QProcess::ExitStatus)));
connect(d->childproc, SIGNAL(error( QProcess::ProcessError )),
SLOT(slotProcessError(QProcess::ProcessError)));
connect(d->lineMaker, SIGNAL(receivedStdoutLines(const QStringList&)),
SLOT(slotReceivedStdout(const QStringList&)));
......@@ -160,6 +162,19 @@ void GitJob::cancel()
d->childproc->kill();
}
void GitJob::slotProcessError( QProcess::ProcessError err )
{
// disconnect all connections to childproc's signals; they are no longer needed
d->childproc->disconnect();
d->isRunning = false;
setError( d->childproc->exitCode() );
setErrorText( i18n("Process exited with status %1", d->childproc->exitCode() ) );
emitResult(); //KJob
emit resultsReady(this); //VcsJob
}
void GitJob::slotProcessExited(int exitCode, QProcess::ExitStatus exitStatus)
{
// disconnect all connections to childproc's signals; they are no longer needed
......
......@@ -95,6 +95,7 @@ class GitJob : public KDevelop::VcsJob
bool isRunning() const;
private slots:
void slotProcessError( QProcess::ProcessError );
void slotProcessExited(int exitCode, QProcess::ExitStatus exitStatus);
void slotReceivedStdout(const QStringList&);
void slotReceivedStderr(const QStringList&);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment