[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kdevelop] /: Use return code to indicate job-failure
From:       Andreas Pakulat <apaku () gmx ! de>
Date:       2013-11-04 1:37:33
Message-ID: E1Vd96j-0001Tq-T7 () scm ! kde ! org
[Download RAW message or body]

Git commit ec28ac120295e653df521a768f22010984cf4d1e by Andreas Pakulat.
Committed on 02/09/2012 at 09:18.
Pushed by apol into branch 'master'.

Use return code to indicate job-failure

CommandExecutor now provides the returncode so this plugin can report
job-failure also when the process finishes, but has a non-zero return code.

M  +8    -3    ninjajob.cpp
M  +1    -1    ninjajob.h

http://commits.kde.org/kdevelop/ec28ac120295e653df521a768f22010984cf4d1e

diff --git a/ninjajob.cpp b/ninjajob.cpp
index 947c09d..149ac34 100644
--- a/ninjajob.cpp
+++ b/ninjajob.cpp
@@ -52,7 +52,7 @@ NinjaJob::NinjaJob(const KUrl& dir, const QStringList& arguments, \
QObject* paren  SLOT(appendLines(QStringList)) );
     
     connect( m_process, SIGNAL(failed(QProcess::ProcessError)), this, \
                SLOT(slotFailed(QProcess::ProcessError)) );
-    connect( m_process, SIGNAL(completed()), this, SLOT(slotCompleted()) );
+    connect( m_process, SIGNAL(completed(int)), this, SLOT(slotCompleted(int)) );
 }
 
 void NinjaJob::signalWhenFinished(const QByteArray& signal, \
KDevelop::ProjectBaseItem* item) @@ -86,10 +86,15 @@ bool NinjaJob::doKill()
     return true;
 }
 
-void NinjaJob::slotCompleted()
+void NinjaJob::slotCompleted(int code)
 {
+    if( code != 0 ) {
+        setError( FailedShownError );
+        m_model->appendLine( i18n("*** Failed ***") );
+    } else {
+        m_model->appendLine( i18n("*** Finished ***") );
+    }
     emitResult();
-    m_model->appendLine( i18n("*** Finished ***") );
 }
 
 void NinjaJob::slotFailed(QProcess::ProcessError error)
diff --git a/ninjajob.h b/ninjajob.h
index 3ba34e5..39dc285 100644
--- a/ninjajob.h
+++ b/ninjajob.h
@@ -46,7 +46,7 @@ class NinjaJob : public KDevelop::OutputJob
 
     private slots:
         void slotFailed(QProcess::ProcessError error);
-        void slotCompleted();
+        void slotCompleted(int);
         void appendLines(const QStringList& lines);
         void emitProjectBuilderSignal(KJob* job);
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic