Переглянути джерело

HPCC-16996 Show compiler errors and warnings generated by bundle install

Signed-off-by: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 8 роки тому
батько
коміт
02336dfb44

+ 7 - 2
ecl/ecl-bundle/ecl-bundle.cpp

@@ -118,9 +118,10 @@ unsigned doPipeCommand(StringBuffer &output, const char *cmd, const char *args,
         if (input)
         if (input)
             printf("with input %s\n", input);
             printf("with input %s\n", input);
     }
     }
-    unsigned ret = runExternalCommand(output, runcmd, input);
+    StringBuffer error;
+    unsigned ret = runExternalCommand(output, error, runcmd, input);
     if (optVerbose && (ret > 0))
     if (optVerbose && (ret > 0))
-        printf("%s return code was %d\n", cmd, ret);
+        printf("%s return code was %d\n%s\n", cmd, ret, error.str());
     return ret;
     return ret;
 }
 }
 
 
@@ -414,7 +415,11 @@ public:
                                     " [ (UTF8) COUNT(B.dependsOn) ] + B.dependsOn + "
                                     " [ (UTF8) COUNT(B.dependsOn) ] + B.dependsOn + "
                                     " [ (UTF8) #IFDEFINED(B.platformVersion, '')]", bundleName.str());
                                     " [ (UTF8) #IFDEFINED(B.platformVersion, '')]", bundleName.str());
             if (doPipeCommand(output, queryEclccPath(), eclOpts.str(), bundleCmd) > 0)
             if (doPipeCommand(output, queryEclccPath(), eclOpts.str(), bundleCmd) > 0)
+            {
+                if (optVerbose)
+                    printf("eclcc reported:\n%s", output.str());
                 throw MakeStringException(0, "%s cannot be parsed as a bundle\n", suppliedname);
                 throw MakeStringException(0, "%s cannot be parsed as a bundle\n", suppliedname);
+            }
             // output should contain [ 'name', 'version', etc ... ]
             // output should contain [ 'name', 'version', etc ... ]
             if (optVerbose)
             if (optVerbose)
                 printf("Bundle info from ECL compiler: %s\n", output.str());
                 printf("Bundle info from ECL compiler: %s\n", output.str());

+ 4 - 4
plugins/fileservices/fileservices.cpp

@@ -500,10 +500,10 @@ FILESERVICES_API void FILESERVICES_CALL fsSendEmailAttachData(ICodeContext * ctx
 
 
 FILESERVICES_API char * FILESERVICES_CALL fsCmdProcess(const char *prog, const char *src)
 FILESERVICES_API char * FILESERVICES_CALL fsCmdProcess(const char *prog, const char *src)
 {
 {
-    StringBuffer in, out;
+    StringBuffer in, out, err;
     in.append(src);
     in.append(src);
 
 
-    runExternalCommand(out, prog, in);
+    runExternalCommand(out, err, prog, in);
 
 
     return CTXSTRDUP(parentCtx, out.str());
     return CTXSTRDUP(parentCtx, out.str());
 }
 }
@@ -511,10 +511,10 @@ FILESERVICES_API char * FILESERVICES_CALL fsCmdProcess(const char *prog, const c
 
 
 FILESERVICES_API void FILESERVICES_CALL fsCmdProcess2(unsigned & tgtLen, char * & tgt, const char *prog, unsigned srcLen, const char * src)
 FILESERVICES_API void FILESERVICES_CALL fsCmdProcess2(unsigned & tgtLen, char * & tgt, const char *prog, unsigned srcLen, const char * src)
 {
 {
-    StringBuffer in, out;
+    StringBuffer in, out, err;
     in.append(srcLen, src);
     in.append(srcLen, src);
 
 
-    runExternalCommand(out, prog, in);
+    runExternalCommand(out, err, prog, in);
 
 
     tgtLen = out.length();
     tgtLen = out.length();
     tgt = (char *)CTXDUP(parentCtx, out.str(), out.length());
     tgt = (char *)CTXDUP(parentCtx, out.str(), out.length());

+ 2 - 2
system/jlib/jthread.cpp

@@ -1831,7 +1831,6 @@ protected: friend class PipeWriterThread;
             CriticalBlock block(sect); // clear forkthread and stderrbufferthread
             CriticalBlock block(sect); // clear forkthread and stderrbufferthread
             ft.setown(forkthread.getClear());
             ft.setown(forkthread.getClear());
             et = stderrbufferthread;
             et = stderrbufferthread;
-            stderrbufferthread = NULL;
         }
         }
         if (ft)
         if (ft)
         {
         {
@@ -1841,7 +1840,7 @@ protected: friend class PipeWriterThread;
         if (et)
         if (et)
         {
         {
             et->stop();
             et->stop();
-            delete et;
+            // NOTE - we don't delete it here, since we want to be able to still read the buffered data
         }
         }
     }
     }
 public:
 public:
@@ -1870,6 +1869,7 @@ public:
         closeOutput();
         closeOutput();
         closeError();
         closeError();
         clearUtilityThreads();
         clearUtilityThreads();
+        delete stderrbufferthread;
     }
     }
 
 
 
 

+ 1 - 2
system/jlib/jutil.cpp

@@ -1746,7 +1746,7 @@ static const char *findExtension(const char *fn)
     return ret;
     return ret;
 }
 }
 
 
-unsigned runExternalCommand(StringBuffer &output, const char *cmd, const char *input)
+unsigned runExternalCommand(StringBuffer &output, StringBuffer &error, const char *cmd, const char *input)
 {
 {
     try
     try
     {
     {
@@ -1768,7 +1768,6 @@ unsigned runExternalCommand(StringBuffer &output, const char *cmd, const char *i
                 output.append(read, buf);
                 output.append(read, buf);
             }
             }
             ret = pipe->wait();
             ret = pipe->wait();
-            StringBuffer error;
             while (true)
             while (true)
             {
             {
                 size32_t read = pipe->readError(sizeof(buf), buf);
                 size32_t read = pipe->readError(sizeof(buf), buf);

+ 1 - 1
system/jlib/jutil.hpp

@@ -227,7 +227,7 @@ extern jlib_decl void doStackProbe();
 #define arraysize(T) (sizeof(T)/sizeof(*T))
 #define arraysize(T) (sizeof(T)/sizeof(*T))
 #endif
 #endif
 
 
-extern jlib_decl unsigned runExternalCommand(StringBuffer &output, const char *cmd, const char *input);
+extern jlib_decl unsigned runExternalCommand(StringBuffer &output, StringBuffer &error, const char *cmd, const char *input);
 
 
 extern jlib_decl unsigned __int64 greatestCommonDivisor(unsigned __int64 left, unsigned __int64 right);
 extern jlib_decl unsigned __int64 greatestCommonDivisor(unsigned __int64 left, unsigned __int64 right);