Преглед изворни кода

Merge pull request #9579 from richardkchapman/thor-pipe-regression

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

Reviewed-by: Gavin Halliday <ghalliday@hpccsystems.com>
Gavin Halliday пре 8 година
родитељ
комит
9a3c587623
1 измењених фајлова са 9 додато и 6 уклоњено
  1. 9 6
      system/jlib/jthread.cpp

+ 9 - 6
system/jlib/jthread.cpp

@@ -1823,14 +1823,16 @@ protected: friend class PipeWriterThread;
     StringArray envVars;
     StringArray envVars;
     StringArray envValues;
     StringArray envValues;
 
 
-    void clearUtilityThreads()
+    void clearUtilityThreads(bool clearStderr)
     {
     {
         Owned<cForkThread> ft;
         Owned<cForkThread> ft;
         cStdErrorBufferThread *et;
         cStdErrorBufferThread *et;
         {
         {
-            CriticalBlock block(sect); // clear forkthread and stderrbufferthread
+            CriticalBlock block(sect); // clear forkthread and optionally stderrbufferthread
             ft.setown(forkthread.getClear());
             ft.setown(forkthread.getClear());
             et = stderrbufferthread;
             et = stderrbufferthread;
+            if (clearStderr)
+                stderrbufferthread = nullptr;
         }
         }
         if (ft)
         if (ft)
         {
         {
@@ -1840,7 +1842,8 @@ protected: friend class PipeWriterThread;
         if (et)
         if (et)
         {
         {
             et->stop();
             et->stop();
-            // NOTE - we don't delete it here, since we want to be able to still read the buffered data
+            if (clearStderr)
+                delete et;
         }
         }
     }
     }
 public:
 public:
@@ -1868,8 +1871,7 @@ public:
         closeInput();
         closeInput();
         closeOutput();
         closeOutput();
         closeError();
         closeError();
-        clearUtilityThreads();
-        delete stderrbufferthread;
+        clearUtilityThreads(true);
     }
     }
 
 
 
 
@@ -2163,7 +2165,8 @@ public:
                 }
                 }
             }
             }
         }
         }
-        clearUtilityThreads(); // NB: will recall forkthread->join(), but doesn't matter
+        // NOTE - we don't clear stderrbufferthread here, since we want to be able to still read the buffered data
+        clearUtilityThreads(false); // NB: will recall forkthread->join(), but doesn't matter
         if (pipeProcess != (HANDLE)-1)
         if (pipeProcess != (HANDLE)-1)
         {
         {
             if (title.length())
             if (title.length())