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

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

Signed-off-by: Mark Kelly <mark.kelly@lexisnexisrisk.com>
Mark Kelly 6 роки тому
батько
коміт
7a008c381e
1 змінених файлів з 9 додано та 1 видалено
  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__
     }