Parcourir la source

ecl run should show failed workunit results

ecl run currently only shows the results for workunits that complete,
showing failed results would provide the user with error information.

Signed-off-by: Anthony Fishbeck <Anthony.Fishbeck@lexisnexis.com>
Anthony Fishbeck il y a 13 ans
Parent
commit
66f797e4ff
2 fichiers modifiés avec 15 ajouts et 11 suppressions
  1. 3 6
      ecl/eclcmd/eclcmd_core.cpp
  2. 12 5
      esp/services/ws_workunits/ws_workunitsService.cpp

+ 3 - 6
ecl/eclcmd/eclcmd_core.cpp

@@ -550,14 +550,11 @@ public:
 
         StringBuffer respwuid(resp->getWuid());
         if (optVerbose && respwuid.length() && !streq(wuid.str(), respwuid.str()))
-            fprintf(stderr, "As %s\n", resp->getWuid());
+            fprintf(stdout, "As %s\n", respwuid.str());
         if (!streq(resp->getState(), "completed"))
-        {
-            fprintf(stderr, "%s\n", resp->getState());
-            return 1;
-        }
+            fprintf(stderr, "%s %s\n", respwuid.str(), resp->getState());
         if (resp->getResults())
-            fprintf(stdout, "%s", resp->getResults());
+            fprintf(stdout, "%s\n", resp->getResults());
 
         return 0;
     }

+ 12 - 5
esp/services/ws_workunits/ws_workunitsService.cpp

@@ -991,13 +991,20 @@ bool CWsWorkunitsEx::onWURun(IEspContext &context, IEspWURunRequest &req, IEspWU
         resp.setState(cw->getStateDesc(stateDesc).str());
         resp.setWuid(wuid.str());
 
-        if (cw->getState()==WUStateCompleted)
+        switch (cw->getState())
         {
-            SCMStringBuffer result;
-            getFullWorkUnitResultsXML(context.queryUserId(), context.queryPassword(), cw.get(), result, false, ExceptionSeverityInformation);
-            resp.setResults(result.str());
+            case WUStateCompleted:
+            case WUStateFailed:
+            case WUStateUnknown:
+            {
+                SCMStringBuffer result;
+                getFullWorkUnitResultsXML(context.queryUserId(), context.queryPassword(), cw.get(), result, false, ExceptionSeverityInformation);
+                resp.setResults(result.str());
+                break;
+            }
+            default:
+                break;
         }
-
     }
     catch(IException* e)
     {