Github user squito commented on a diff in the pull request:

    https://github.com/apache/spark/pull/22612#discussion_r237975861
  
    --- Diff: 
core/src/main/scala/org/apache/spark/executor/ProcfsMetricsGetter.scala ---
    @@ -138,19 +138,22 @@ private[spark] class ProcfsMetricsGetter(
           }
           val stdoutThread = Utils.processStreamByLine("read stdout for pgrep",
             process.getInputStream, appendChildPid)
    -      val error = process.getErrorStream
    -      var errorString = ""
    -      (0 until error.available()).foreach { i =>
    -        errorString += error.read()
    -      }
    +      val errorStringBuilder = new StringBuilder()
    +      val stdErrThread = Utils.processStreamByLine(
    +        "stderr for pgrep",
    +        process.getErrorStream,
    +        { line =>
    +        errorStringBuilder.append(line)
    +      })
    --- End diff --
    
    nit: if the line-handling closure is multiline, you should indent the body 
more.  but I'd just put it on one line
    
    ```scala
    val stdErrThread = Utils.processStreamByLine(
      "stderr for pgrep",
      process.getErrorStream,
      line => errorStringBuilder.append(line))
    ```


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to