Procházet zdrojové kódy

HPCC-21321 Lsblk pipe cmd log stderr only on error (2)

Signed-off-by: Mark Kelly <mark.kelly@lexisnexisrisk.com>
Mark Kelly před 6 roky
rodič
revize
7a008c381e
1 změnil soubory, kde provedl 9 přidání a 1 odebrání
  1. 9 1
      system/jlib/jdebug.cpp

+ 9 - 1
system/jlib/jdebug.cpp

@@ -1995,7 +1995,7 @@ public:
         // and match those with entries in /proc/diskstats
         StringBuffer cmd("lsblk -o TYPE,MAJ:MIN --pairs");
         Owned<IPipeProcess> pipe = createPipeProcess();
-        if (pipe->run("list disks", cmd, nullptr, false, true))
+        if (pipe->run("list disks", cmd, nullptr, false, true, true, 8192))
         {
             StringBuffer output;
             Owned<ISimpleReadStream> pipeReader = pipe->getOutputStream();
@@ -2016,6 +2016,14 @@ public:
                     }
                 }
             }
+            else
+            {
+                StringBuffer outputErr;
+                Owned<ISimpleReadStream> pipeReaderErr = pipe->getErrorStream();
+                readSimpleStream(outputErr, *pipeReaderErr);
+                if (outputErr.length() > 0)
+                    WARNLOG("WARNING: Pipe: output: %s", outputErr.str());
+            }
         }
 #endif // __linux__
     }